ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/sbin/fsirand/fsirand.c
(Generate patch)

Comparing trunk/sbin/fsirand/fsirand.c (file contents):
Revision 11215 by laffer1, Sat Dec 7 23:54:44 2013 UTC vs.
Revision 11216 by laffer1, Sun Jul 1 20:51:37 2018 UTC

# Line 1 | Line 1
1 + /* $MidnightBSD$ */
2   /*      $OpenBSD: fsirand.c,v 1.9 1997/02/28 00:46:33 millert Exp $     */
3  
4   /*
# Line 32 | Line 33
33  
34   #ifndef lint
35   static const char rcsid[] =
36 <  "$MidnightBSD$";
36 >  "$FreeBSD: stable/10/sbin/fsirand/fsirand.c 322860 2017-08-24 21:44:23Z mckusick $";
37   #endif /* not lint */
38  
39   #include <sys/param.h>
39 #include <sys/disklabel.h>
40   #include <sys/resource.h>
41  
42   #include <ufs/ufs/dinode.h>
# Line 60 | Line 60 | int fsirand(char *);
60   */
61   static int sblock_try[] = SBLOCKSEARCH;
62  
63 < int printonly = 0, force = 0, ignorelabel = 0;
63 > static int printonly = 0, force = 0, ignorelabel = 0;
64  
65   int
66   main(int argc, char *argv[])
# Line 120 | Line 120 | fsirand(char *device)
120          char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE];
121          int i, devfd, n, cg;
122          u_int32_t bsize = DEV_BSIZE;
123        struct disklabel label;
123  
124          if ((devfd = open(device, printonly ? O_RDONLY : O_RDWR)) < 0) {
125                  warn("can't open %s", device);
126                  return (1);
127          }
128  
130        /* Get block size (usually 512) from disklabel if possible */
131        if (!ignorelabel) {
132                if (ioctl(devfd, DIOCGDINFO, &label) < 0)
133                        warn("can't read disklabel, using sector size of %d",
134                            bsize);
135                else
136                        bsize = label.d_secsize;
137        }
138
129          dp1 = NULL;
130          dp2 = NULL;
131  
# Line 274 | Line 264 | fsirand(char *device)
264                                  dp2 = &((struct ufs2_dinode *)inodebuf)[n];
265                          if (inumber >= ROOTINO) {
266                                  if (printonly)
267 <                                        (void)printf("ino %d gen %08x\n",
268 <                                            inumber,
267 >                                        (void)printf("ino %ju gen %08x\n",
268 >                                            (uintmax_t)inumber,
269                                              sblock->fs_magic == FS_UFS1_MAGIC ?
270                                              dp1->di_gen : dp2->di_gen);
271                                  else if (sblock->fs_magic == FS_UFS1_MAGIC)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines