Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / fs / ufs / util.h
blob3aa3297b964ae0fab38eb9555dfdf58987b2d015
1 /*
2 * linux/fs/ufs/util.h
4 * Copyright (C) 1998
5 * Daniel Pirkl <daniel.pirkl@email.cz>
6 * Charles University, Faculty of Mathematics and Physics
7 */
9 #include <linux/buffer_head.h>
10 #include <linux/fs.h>
11 #include "swab.h"
15 * some useful macros
17 #define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len))
20 * functions used for retyping
22 static inline struct ufs_buffer_head *UCPI_UBH(struct ufs_cg_private_info *cpi)
24 return &cpi->c_ubh;
26 static inline struct ufs_buffer_head *USPI_UBH(struct ufs_sb_private_info *spi)
28 return &spi->s_ubh;
34 * macros used for accessing structures
36 static inline s32
37 ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
38 struct ufs_super_block_third *usb3)
40 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
41 case UFS_ST_SUNOS:
42 if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
43 return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
44 /* Fall Through to UFS_ST_SUN */
45 case UFS_ST_SUN:
46 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
47 case UFS_ST_SUNx86:
48 return fs32_to_cpu(sb, usb1->fs_u1.fs_sunx86.fs_state);
49 case UFS_ST_44BSD:
50 default:
51 return fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_state);
55 static inline void
56 ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
57 struct ufs_super_block_third *usb3, s32 value)
59 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
60 case UFS_ST_SUNOS:
61 <<<<<<< HEAD:fs/ufs/util.h
62 if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
63 =======
64 if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) {
65 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:fs/ufs/util.h
66 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
67 break;
69 /* Fall Through to UFS_ST_SUN */
70 case UFS_ST_SUN:
71 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
72 break;
73 case UFS_ST_SUNx86:
74 usb1->fs_u1.fs_sunx86.fs_state = cpu_to_fs32(sb, value);
75 break;
76 case UFS_ST_44BSD:
77 usb3->fs_un2.fs_44.fs_state = cpu_to_fs32(sb, value);
78 break;
82 static inline u32
83 ufs_get_fs_npsect(struct super_block *sb, struct ufs_super_block_first *usb1,
84 struct ufs_super_block_third *usb3)
86 if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86)
87 return fs32_to_cpu(sb, usb3->fs_un2.fs_sunx86.fs_npsect);
88 else
89 return fs32_to_cpu(sb, usb1->fs_u1.fs_sun.fs_npsect);
92 static inline u64
93 ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
95 __fs64 tmp;
97 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
98 case UFS_ST_SUNOS:
99 case UFS_ST_SUN:
100 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
101 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1];
102 break;
103 case UFS_ST_SUNx86:
104 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qbmask[0];
105 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qbmask[1];
106 break;
107 case UFS_ST_44BSD:
108 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qbmask[0];
109 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qbmask[1];
110 break;
113 return fs64_to_cpu(sb, tmp);
116 static inline u64
117 ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
119 __fs64 tmp;
121 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
122 case UFS_ST_SUNOS:
123 case UFS_ST_SUN:
124 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
125 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
126 break;
127 case UFS_ST_SUNx86:
128 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qfmask[0];
129 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qfmask[1];
130 break;
131 case UFS_ST_44BSD:
132 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qfmask[0];
133 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qfmask[1];
134 break;
137 return fs64_to_cpu(sb, tmp);
140 static inline u16
141 ufs_get_de_namlen(struct super_block *sb, struct ufs_dir_entry *de)
143 if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) == UFS_DE_OLD)
144 return fs16_to_cpu(sb, de->d_u.d_namlen);
145 else
146 return de->d_u.d_44.d_namlen; /* XXX this seems wrong */
149 static inline void
150 ufs_set_de_namlen(struct super_block *sb, struct ufs_dir_entry *de, u16 value)
152 if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) == UFS_DE_OLD)
153 de->d_u.d_namlen = cpu_to_fs16(sb, value);
154 else
155 de->d_u.d_44.d_namlen = value; /* XXX this seems wrong */
158 static inline void
159 ufs_set_de_type(struct super_block *sb, struct ufs_dir_entry *de, int mode)
161 if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) != UFS_DE_44BSD)
162 return;
165 * TODO turn this into a table lookup
167 switch (mode & S_IFMT) {
168 case S_IFSOCK:
169 de->d_u.d_44.d_type = DT_SOCK;
170 break;
171 case S_IFLNK:
172 de->d_u.d_44.d_type = DT_LNK;
173 break;
174 case S_IFREG:
175 de->d_u.d_44.d_type = DT_REG;
176 break;
177 case S_IFBLK:
178 de->d_u.d_44.d_type = DT_BLK;
179 break;
180 case S_IFDIR:
181 de->d_u.d_44.d_type = DT_DIR;
182 break;
183 case S_IFCHR:
184 de->d_u.d_44.d_type = DT_CHR;
185 break;
186 case S_IFIFO:
187 de->d_u.d_44.d_type = DT_FIFO;
188 break;
189 default:
190 de->d_u.d_44.d_type = DT_UNKNOWN;
194 static inline u32
195 ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
197 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
198 case UFS_UID_44BSD:
199 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid);
200 case UFS_UID_EFT:
201 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
202 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
203 /* Fall through */
204 default:
205 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
209 static inline void
210 ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
212 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
213 case UFS_UID_44BSD:
214 inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value);
215 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
216 break;
217 case UFS_UID_EFT:
218 inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
219 if (value > 0xFFFF)
220 value = 0xFFFF;
221 /* Fall through */
222 default:
223 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
224 break;
228 static inline u32
229 ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
231 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
232 case UFS_UID_44BSD:
233 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
234 case UFS_UID_EFT:
235 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
236 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
237 /* Fall through */
238 default:
239 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
243 static inline void
244 ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
246 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
247 case UFS_UID_44BSD:
248 inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value);
249 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
250 break;
251 case UFS_UID_EFT:
252 inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
253 if (value > 0xFFFF)
254 value = 0xFFFF;
255 /* Fall through */
256 default:
257 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
258 break;
262 extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *);
263 extern void ufs_set_inode_dev(struct super_block *, struct ufs_inode_info *, dev_t);
264 extern int __ufs_write_begin(struct file *file, struct address_space *mapping,
265 loff_t pos, unsigned len, unsigned flags,
266 struct page **pagep, void **fsdata);
269 * These functions manipulate ufs buffers
271 #define ubh_bread(sb,fragment,size) _ubh_bread_(uspi,sb,fragment,size)
272 extern struct ufs_buffer_head * _ubh_bread_(struct ufs_sb_private_info *, struct super_block *, u64 , u64);
273 extern struct ufs_buffer_head * ubh_bread_uspi(struct ufs_sb_private_info *, struct super_block *, u64, u64);
274 extern void ubh_brelse (struct ufs_buffer_head *);
275 extern void ubh_brelse_uspi (struct ufs_sb_private_info *);
276 extern void ubh_mark_buffer_dirty (struct ufs_buffer_head *);
277 extern void ubh_mark_buffer_uptodate (struct ufs_buffer_head *, int);
278 extern void ubh_ll_rw_block(int, struct ufs_buffer_head *);
279 extern void ubh_wait_on_buffer (struct ufs_buffer_head *);
280 extern void ubh_bforget (struct ufs_buffer_head *);
281 extern int ubh_buffer_dirty (struct ufs_buffer_head *);
282 #define ubh_ubhcpymem(mem,ubh,size) _ubh_ubhcpymem_(uspi,mem,ubh,size)
283 extern void _ubh_ubhcpymem_(struct ufs_sb_private_info *, unsigned char *, struct ufs_buffer_head *, unsigned);
284 #define ubh_memcpyubh(ubh,mem,size) _ubh_memcpyubh_(uspi,ubh,mem,size)
285 extern void _ubh_memcpyubh_(struct ufs_sb_private_info *, struct ufs_buffer_head *, unsigned char *, unsigned);
287 /* This functions works with cache pages*/
288 extern struct page *ufs_get_locked_page(struct address_space *mapping,
289 pgoff_t index);
290 static inline void ufs_put_locked_page(struct page *page)
292 unlock_page(page);
293 page_cache_release(page);
298 * macros and inline function to get important structures from ufs_sb_private_info
301 static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
302 unsigned int offset)
304 unsigned int index;
306 index = offset >> uspi->s_fshift;
307 offset &= ~uspi->s_fmask;
308 return uspi->s_ubh.bh[index]->b_data + offset;
311 #define ubh_get_usb_first(uspi) \
312 ((struct ufs_super_block_first *)get_usb_offset((uspi), 0))
314 #define ubh_get_usb_second(uspi) \
315 ((struct ufs_super_block_second *)get_usb_offset((uspi), UFS_SECTOR_SIZE))
317 #define ubh_get_usb_third(uspi) \
318 ((struct ufs_super_block_third *)get_usb_offset((uspi), 2*UFS_SECTOR_SIZE))
321 #define ubh_get_ucg(ubh) \
322 ((struct ufs_cylinder_group *)((ubh)->bh[0]->b_data))
326 * Extract byte from ufs_buffer_head
327 * Extract the bits for a block from a map inside ufs_buffer_head
329 #define ubh_get_addr8(ubh,begin) \
330 ((u8*)(ubh)->bh[(begin) >> uspi->s_fshift]->b_data + \
331 ((begin) & ~uspi->s_fmask))
333 #define ubh_get_addr16(ubh,begin) \
334 (((__fs16*)((ubh)->bh[(begin) >> (uspi->s_fshift-1)]->b_data)) + \
335 ((begin) & ((uspi->fsize>>1) - 1)))
337 #define ubh_get_addr32(ubh,begin) \
338 (((__fs32*)((ubh)->bh[(begin) >> (uspi->s_fshift-2)]->b_data)) + \
339 ((begin) & ((uspi->s_fsize>>2) - 1)))
341 #define ubh_get_addr64(ubh,begin) \
342 (((__fs64*)((ubh)->bh[(begin) >> (uspi->s_fshift-3)]->b_data)) + \
343 ((begin) & ((uspi->s_fsize>>3) - 1)))
345 #define ubh_get_addr ubh_get_addr8
347 static inline void *ubh_get_data_ptr(struct ufs_sb_private_info *uspi,
348 struct ufs_buffer_head *ubh,
349 u64 blk)
351 if (uspi->fs_magic == UFS2_MAGIC)
352 return ubh_get_addr64(ubh, blk);
353 else
354 return ubh_get_addr32(ubh, blk);
357 #define ubh_blkmap(ubh,begin,bit) \
358 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb)))
361 * Determine the number of available frags given a
362 * percentage to hold in reserve.
364 static inline u64
365 ufs_freespace(struct ufs_sb_private_info *uspi, int percentreserved)
367 return ufs_blkstofrags(uspi->cs_total.cs_nbfree) +
368 uspi->cs_total.cs_nffree -
369 (uspi->s_dsize * (percentreserved) / 100);
373 * Macros to access cylinder group array structures
375 #define ubh_cg_blktot(ucpi,cylno) \
376 (*((__fs32*)ubh_get_addr(UCPI_UBH(ucpi), (ucpi)->c_btotoff + ((cylno) << 2))))
378 #define ubh_cg_blks(ucpi,cylno,rpos) \
379 (*((__fs16*)ubh_get_addr(UCPI_UBH(ucpi), \
380 (ucpi)->c_boff + (((cylno) * uspi->s_nrpos + (rpos)) << 1 ))))
383 * Bitmap operations
384 * These functions work like classical bitmap operations.
385 * The difference is that we don't have the whole bitmap
386 * in one contiguous chunk of memory, but in several buffers.
387 * The parameters of each function are super_block, ufs_buffer_head and
388 * position of the beginning of the bitmap.
390 #define ubh_setbit(ubh,begin,bit) \
391 (*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) |= (1 << ((bit) & 7)))
393 #define ubh_clrbit(ubh,begin,bit) \
394 (*ubh_get_addr (ubh, (begin) + ((bit) >> 3)) &= ~(1 << ((bit) & 7)))
396 #define ubh_isset(ubh,begin,bit) \
397 (*ubh_get_addr (ubh, (begin) + ((bit) >> 3)) & (1 << ((bit) & 7)))
399 #define ubh_isclr(ubh,begin,bit) (!ubh_isset(ubh,begin,bit))
401 #define ubh_find_first_zero_bit(ubh,begin,size) _ubh_find_next_zero_bit_(uspi,ubh,begin,size,0)
403 #define ubh_find_next_zero_bit(ubh,begin,size,offset) _ubh_find_next_zero_bit_(uspi,ubh,begin,size,offset)
404 static inline unsigned _ubh_find_next_zero_bit_(
405 struct ufs_sb_private_info * uspi, struct ufs_buffer_head * ubh,
406 unsigned begin, unsigned size, unsigned offset)
408 unsigned base, count, pos;
410 size -= offset;
411 begin <<= 3;
412 offset += begin;
413 base = offset >> uspi->s_bpfshift;
414 offset &= uspi->s_bpfmask;
415 for (;;) {
416 count = min_t(unsigned int, size + offset, uspi->s_bpf);
417 size -= count - offset;
418 pos = ext2_find_next_zero_bit (ubh->bh[base]->b_data, count, offset);
419 if (pos < count || !size)
420 break;
421 base++;
422 offset = 0;
424 return (base << uspi->s_bpfshift) + pos - begin;
427 static inline unsigned find_last_zero_bit (unsigned char * bitmap,
428 unsigned size, unsigned offset)
430 unsigned bit, i;
431 unsigned char * mapp;
432 unsigned char map;
434 mapp = bitmap + (size >> 3);
435 map = *mapp--;
436 bit = 1 << (size & 7);
437 for (i = size; i > offset; i--) {
438 if ((map & bit) == 0)
439 break;
440 if ((i & 7) != 0) {
441 bit >>= 1;
442 } else {
443 map = *mapp--;
444 bit = 1 << 7;
447 return i;
450 #define ubh_find_last_zero_bit(ubh,begin,size,offset) _ubh_find_last_zero_bit_(uspi,ubh,begin,size,offset)
451 static inline unsigned _ubh_find_last_zero_bit_(
452 struct ufs_sb_private_info * uspi, struct ufs_buffer_head * ubh,
453 unsigned begin, unsigned start, unsigned end)
455 unsigned base, count, pos, size;
457 size = start - end;
458 begin <<= 3;
459 start += begin;
460 base = start >> uspi->s_bpfshift;
461 start &= uspi->s_bpfmask;
462 for (;;) {
463 count = min_t(unsigned int,
464 size + (uspi->s_bpf - start), uspi->s_bpf)
465 - (uspi->s_bpf - start);
466 size -= count;
467 pos = find_last_zero_bit (ubh->bh[base]->b_data,
468 start, start - count);
469 if (pos > start - count || !size)
470 break;
471 base--;
472 start = uspi->s_bpf;
474 return (base << uspi->s_bpfshift) + pos - begin;
477 #define ubh_isblockclear(ubh,begin,block) (!_ubh_isblockset_(uspi,ubh,begin,block))
479 #define ubh_isblockset(ubh,begin,block) _ubh_isblockset_(uspi,ubh,begin,block)
480 static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi,
481 struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
483 switch (uspi->s_fpb) {
484 case 8:
485 return (*ubh_get_addr (ubh, begin + block) == 0xff);
486 case 4:
487 return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2)));
488 case 2:
489 return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1)));
490 case 1:
491 return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07)));
493 return 0;
496 #define ubh_clrblock(ubh,begin,block) _ubh_clrblock_(uspi,ubh,begin,block)
497 static inline void _ubh_clrblock_(struct ufs_sb_private_info * uspi,
498 struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
500 switch (uspi->s_fpb) {
501 case 8:
502 *ubh_get_addr (ubh, begin + block) = 0x00;
503 return;
504 case 4:
505 *ubh_get_addr (ubh, begin + (block >> 1)) &= ~(0x0f << ((block & 0x01) << 2));
506 return;
507 case 2:
508 *ubh_get_addr (ubh, begin + (block >> 2)) &= ~(0x03 << ((block & 0x03) << 1));
509 return;
510 case 1:
511 *ubh_get_addr (ubh, begin + (block >> 3)) &= ~(0x01 << ((block & 0x07)));
512 return;
516 #define ubh_setblock(ubh,begin,block) _ubh_setblock_(uspi,ubh,begin,block)
517 static inline void _ubh_setblock_(struct ufs_sb_private_info * uspi,
518 struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
520 switch (uspi->s_fpb) {
521 case 8:
522 *ubh_get_addr(ubh, begin + block) = 0xff;
523 return;
524 case 4:
525 *ubh_get_addr(ubh, begin + (block >> 1)) |= (0x0f << ((block & 0x01) << 2));
526 return;
527 case 2:
528 *ubh_get_addr(ubh, begin + (block >> 2)) |= (0x03 << ((block & 0x03) << 1));
529 return;
530 case 1:
531 *ubh_get_addr(ubh, begin + (block >> 3)) |= (0x01 << ((block & 0x07)));
532 return;
536 static inline void ufs_fragacct (struct super_block * sb, unsigned blockmap,
537 __fs32 * fraglist, int cnt)
539 struct ufs_sb_private_info * uspi;
540 unsigned fragsize, pos;
542 uspi = UFS_SB(sb)->s_uspi;
544 fragsize = 0;
545 for (pos = 0; pos < uspi->s_fpb; pos++) {
546 if (blockmap & (1 << pos)) {
547 fragsize++;
549 else if (fragsize > 0) {
550 fs32_add(sb, &fraglist[fragsize], cnt);
551 fragsize = 0;
554 if (fragsize > 0 && fragsize < uspi->s_fpb)
555 fs32_add(sb, &fraglist[fragsize], cnt);
558 static inline void *ufs_get_direct_data_ptr(struct ufs_sb_private_info *uspi,
559 struct ufs_inode_info *ufsi,
560 unsigned blk)
562 BUG_ON(blk > UFS_TIND_BLOCK);
563 return uspi->fs_magic == UFS2_MAGIC ?
564 (void *)&ufsi->i_u1.u2_i_data[blk] :
565 (void *)&ufsi->i_u1.i_data[blk];
568 static inline u64 ufs_data_ptr_to_cpu(struct super_block *sb, void *p)
570 return UFS_SB(sb)->s_uspi->fs_magic == UFS2_MAGIC ?
571 fs64_to_cpu(sb, *(__fs64 *)p) :
572 fs32_to_cpu(sb, *(__fs32 *)p);
575 static inline void ufs_cpu_to_data_ptr(struct super_block *sb, void *p, u64 val)
577 if (UFS_SB(sb)->s_uspi->fs_magic == UFS2_MAGIC)
578 *(__fs64 *)p = cpu_to_fs64(sb, val);
579 else
580 *(__fs32 *)p = cpu_to_fs32(sb, val);
583 static inline void ufs_data_ptr_clear(struct ufs_sb_private_info *uspi,
584 void *p)
586 if (uspi->fs_magic == UFS2_MAGIC)
587 *(__fs64 *)p = 0;
588 else
589 *(__fs32 *)p = 0;
592 static inline int ufs_is_data_ptr_zero(struct ufs_sb_private_info *uspi,
593 void *p)
595 if (uspi->fs_magic == UFS2_MAGIC)
596 return *(__fs64 *)p == 0;
597 else
598 return *(__fs32 *)p == 0;