Author: emaste
Date: Wed Aug 21 19:07:13 2019
New Revision: 351346
URL: https://svnweb.freebsd.org/changeset/base/351346

Log:
  makefs: share denode.h between kernel msdosfs and makefs
  
  There is no need to duplicate this file when it can be trivially
  shared (just exposing sections previously under #ifdef _KERNEL).
  
  MFC with:     r351273
  Differential Revision:        The FreeBSD Foundation

Deleted:
  head/usr.sbin/makefs/msdos/denode.h
Modified:
  head/sys/fs/msdosfs/denode.h
  head/usr.sbin/makefs/ffs/buf.h
  head/usr.sbin/makefs/msdos.c
  head/usr.sbin/makefs/msdos/msdosfs_conv.c
  head/usr.sbin/makefs/msdos/msdosfs_denode.c
  head/usr.sbin/makefs/msdos/msdosfs_fat.c
  head/usr.sbin/makefs/msdos/msdosfs_lookup.c
  head/usr.sbin/makefs/msdos/msdosfs_vfsops.c
  head/usr.sbin/makefs/msdos/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/denode.h
==============================================================================
--- head/sys/fs/msdosfs/denode.h        Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/sys/fs/msdosfs/denode.h        Wed Aug 21 19:07:13 2019        
(r351346)
@@ -213,7 +213,7 @@ struct denode {
             ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), 
\
         putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16))
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(MAKEFS)
 
 #define        VTODE(vp)       ((struct denode *)(vp)->v_data)
 #define        DETOV(de)       ((de)->de_vnode)
@@ -262,9 +262,11 @@ struct defid {
 
 extern struct vop_vector msdosfs_vnodeops;
 
+#ifdef _KERNEL
 int msdosfs_lookup(struct vop_cachedlookup_args *);
 int msdosfs_inactive(struct vop_inactive_args *);
 int msdosfs_reclaim(struct vop_reclaim_args *);
+#endif
 
 /*
  * Internal service routine prototypes.
@@ -283,5 +285,5 @@ int deupdat(struct denode *dep, int waitfor);
 int removede(struct denode *pdep, struct denode *dep);
 int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred);
 int doscheckpath( struct denode *source, struct denode *target);
-#endif /* _KERNEL */
+#endif /* _KERNEL || MAKEFS */
 #endif /* !_FS_MSDOSFS_DENODE_H_ */

Modified: head/usr.sbin/makefs/ffs/buf.h
==============================================================================
--- head/usr.sbin/makefs/ffs/buf.h      Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/ffs/buf.h      Wed Aug 21 19:07:13 2019        
(r351346)
@@ -45,6 +45,7 @@
 #include <sys/param.h>
 #include <sys/queue.h>
 
+struct componentname;
 struct makefs_fsinfo;
 struct ucred;
 

Modified: head/usr.sbin/makefs/msdos.c
==============================================================================
--- head/usr.sbin/makefs/msdos.c        Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos.c        Wed Aug 21 19:07:13 2019        
(r351346)
@@ -55,17 +55,17 @@ __FBSDID("$FreeBSD$");
 #include <dirent.h>
 #include <util.h>
 
+#include "ffs/buf.h"
 #include "makefs.h"
 #include "msdos.h"
 
 #include <mkfs_msdos.h>
 #include <fs/msdosfs/bpb.h>
+#include "msdos/direntry.h"
+#include <fs/msdosfs/denode.h>
 
-#include "ffs/buf.h"
 
 #include "msdos/msdosfsmount.h"
-#include "msdos/direntry.h"
-#include "msdos/denode.h"
 
 static int msdos_populate_dir(const char *, struct denode *, fsnode *,
     fsnode *, fsinfo_t *);

Modified: head/usr.sbin/makefs/msdos/msdosfs_conv.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_conv.c   Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_conv.c   Wed Aug 21 19:07:13 2019        
(r351346)
@@ -56,13 +56,11 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 #include <fs/msdosfs/bpb.h>
+#include "msdos/direntry.h"
+#include "msdos/msdosfsmount.h"
 
 #include "makefs.h"
 #include "msdos.h"
-
-#include "msdos/denode.h"
-#include "msdos/direntry.h"
-#include "msdos/msdosfsmount.h"
 
 static int char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m);
 static void ucs2pad(uint16_t *buf, int len, int size);

Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 19:07:13 2019        
(r351346)
@@ -59,18 +59,18 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <util.h>
 
+#include "ffs/buf.h"
+
 #include <fs/msdosfs/bpb.h>
-#include "msdos/denode.h"
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/direntry.h>
+#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
+#include "msdos/msdosfsmount.h"
 
 #include "makefs.h"
 #include "msdos.h"
 
-#include "ffs/buf.h"
 
-#include "msdos/direntry.h"
-
 /*
  * If deget() succeeds it returns with the gotten denode locked().
  *
@@ -208,7 +208,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon
  * Truncate the file described by dep to the length specified by length.
  */
 int
-detrunc(struct denode *dep, u_long length, int flags)
+detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 {
        int error;
        int allerror;
@@ -240,7 +240,7 @@ detrunc(struct denode *dep, u_long length, int flags)
        }
 
        if (dep->de_FileSize < length)
-               return deextend(dep, length);
+               return deextend(dep, length, cred);
 
        /*
         * If the desired length is 0 then remember the starting cluster of
@@ -333,7 +333,7 @@ detrunc(struct denode *dep, u_long length, int flags)
  * Extend the file described by dep to length specified by length.
  */
 int
-deextend(struct denode *dep, u_long length)
+deextend(struct denode *dep, u_long length, struct ucred *cred)
 {
        struct msdosfsmount *pmp = dep->de_pmp;
        u_long count;
@@ -364,7 +364,7 @@ deextend(struct denode *dep, u_long length)
                error = extendfile(dep, count, NULL, NULL, DE_CLEAR);
                if (error) {
                        /* truncate the added clusters away again */
-                       (void) detrunc(dep, dep->de_FileSize, 0);
+                       (void) detrunc(dep, dep->de_FileSize, 0, cred);
                        return (error);
                }
        }

Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_fat.c    Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_fat.c    Wed Aug 21 19:07:13 2019        
(r351346)
@@ -58,14 +58,13 @@
 #include <string.h>
 #include <strings.h>
 
-#include <fs/msdosfs/bpb.h>
-#include "msdos/denode.h"
-#include "msdos/msdosfsmount.h"
-#include <fs/msdosfs/fat.h>
-
 #include "ffs/buf.h"
 
+#include <fs/msdosfs/bpb.h>
 #include "msdos/direntry.h"
+#include <fs/msdosfs/denode.h>
+#include <fs/msdosfs/fat.h>
+#include "msdos/msdosfsmount.h"
 
 #include "makefs.h"
 #include "msdos.h"

Modified: head/usr.sbin/makefs/msdos/msdosfs_lookup.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 19:07:13 2019        
(r351346)
@@ -56,15 +56,13 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "ffs/buf.h"
 #include <fs/msdosfs/bpb.h>
-#include "msdos/denode.h"
-#include "msdos/msdosfsmount.h"
+#include "msdos/direntry.h"
+#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
+#include "msdos/msdosfsmount.h"
 
-#include "ffs/buf.h"
-
-#include "msdos/direntry.h"
-
 #include "makefs.h"
 #include "msdos.h"
 
@@ -104,7 +102,7 @@ createde(struct denode *dep, struct denode *ddep, stru
                dirclust = de_clcount(pmp, diroffset);
                error = extendfile(ddep, dirclust, 0, 0, DE_CLEAR);
                if (error) {
-                       (void)detrunc(ddep, ddep->de_FileSize, 0);
+                       (void)detrunc(ddep, ddep->de_FileSize, 0, NULL);
                        return error;
                }
 

Modified: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 19:07:13 2019        
(r351346)
@@ -58,20 +58,20 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <util.h>
 
+#include "ffs/buf.h"
 #include <fs/msdosfs/bootsect.h>
 #include <fs/msdosfs/bpb.h>
-#include "msdos/denode.h"
-#include "msdos/msdosfsmount.h"
+#include "msdos/direntry.h"
+#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
+#include "msdos/msdosfsmount.h"
 
 #include <mkfs_msdos.h>
 
 #include "makefs.h"
 #include "msdos.h"
 
-#include "ffs/buf.h"
 
-#include "msdos/direntry.h"
 
 struct msdosfsmount *
 msdosfs_mount(struct vnode *devvp)

Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c
==============================================================================
--- head/usr.sbin/makefs/msdos/msdosfs_vnops.c  Wed Aug 21 18:28:38 2019        
(r351345)
+++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c  Wed Aug 21 19:07:13 2019        
(r351346)
@@ -62,18 +62,16 @@ __FBSDID("$FreeBSD$");
 #include <time.h>
 #include <unistd.h>
 
+#include "ffs/buf.h"
 #include <fs/msdosfs/bpb.h>
-#include "msdos/denode.h"
-#include "msdos/msdosfsmount.h"
+#include "msdos/direntry.h"
+#include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
+#include "msdos/msdosfsmount.h"
 
 #include "makefs.h"
 #include "msdos.h"
 
-#include "ffs/buf.h"
-
-#include "msdos/direntry.h"
-
 /*
  * Some general notes:
  *
@@ -455,7 +453,7 @@ msdosfs_wfile(const char *path, struct denode *dep, fs
        nsize = st->st_size;
        MSDOSFS_DPRINTF(("%s(nsize=%zu, osize=%zu)\n", __func__, nsize, osize));
        if (nsize > osize) {
-               if ((error = deextend(dep, nsize)) != 0)
+               if ((error = deextend(dep, nsize, NULL)) != 0)
                        return error;
                if ((error = msdosfs_updatede(dep)) != 0)
                        return error;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to