Whamcloud - gitweb
ChangeLog, Makefile.in, mkjournal.c:
authorTheodore Ts'o <tytso@mit.edu>
Mon, 11 Jun 2001 00:49:29 +0000 (00:49 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 11 Jun 2001 00:49:29 +0000 (00:49 +0000)
  Makefile.in: Remove the dependence on the libe2p library.
  mkjournal.c (ext2fs_add_journal_inode): Replace use of fsetflags with
   direct usage of the ioctl/fchflags so that we don't have to depend on
   the libe2p library.

lib/ext2fs/ChangeLog
lib/ext2fs/Makefile.in
lib/ext2fs/mkjournal.c

index 7232737..4ff3df4 100644 (file)
@@ -1,3 +1,11 @@
+2001-06-10  Theodore Tso  <tytso@valinux.com>
+
+       * Makefile.in: Remove the dependence on the libe2p library.
+
+       * mkjournal.c (ext2fs_add_journal_inode): Replace use of fsetflags
+               with direct usage of the ioctl/fchflags so that we don't
+               have to depend on the libe2p library.
+
 2001-06-08  Theodore Tso  <tytso@valinux.com>
 
        * ext2_types.h.in: Use unsigned ints in favor of unsigned longs
index 3a69a83..6278b8d 100644 (file)
@@ -122,7 +122,7 @@ DLL_GOTSIZE  = 0x1000
 DLL_VERSION = 1.2
 DLL_IMAGE = libe2fs
 DLL_STUB = libext2fs
-DLL_LIBS = -L../.. -lcom_err -le2p
+DLL_LIBS = -L../.. -lcom_err
 DLL_MYDIR = ext2fs
 DLL_INSTALL_DIR = $(root_libdir)
 
@@ -131,7 +131,7 @@ ELF_SO_VERSION = 2
 ELF_IMAGE = libext2fs
 ELF_MYDIR = ext2fs
 ELF_INSTALL_DIR = $(root_libdir)
-ELF_OTHER_LIBS = -L../.. -lcom_err -le2p
+ELF_OTHER_LIBS = -L../.. -lcom_err
 
 BSDLIB_VERSION = 2.1
 BSDLIB_IMAGE = libext2fs
index bf5ca67..092e4a2 100644 (file)
@@ -25,6 +25,9 @@
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
@@ -306,7 +309,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
        ext2_ino_t              journal_ino;
        struct stat             st;
        char                    jfile[1024];
-       int                     fd, mount_flags;
+       int                     fd, mount_flags, f;
 
        if ((retval = ext2fs_check_mount_point(fs->device_name, &mount_flags,
                                               jfile, sizeof(jfile)-10)))
@@ -324,13 +327,20 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
                        return retval;
 
                /* Get inode number of the journal file */
-               if (stat(jfile, &st) < 0)
+               if (fstat(fd, &st) < 0)
                        return errno;
 
-               if ((retval = fsetflags(jfile,
-                                       EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL)))
+#if HAVE_CHFLAGS
+               retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
+#else
+#if HAVE_EXT2_IOCTLS
+               f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;;
+               retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f);
+#endif
+#endif
+               if (retval)
                        return retval;
-               
+
                journal_ino = st.st_ino;
        } else {
                journal_ino = EXT2_JOURNAL_INO;