mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, ext2fs.h, ismounted.c:
ismounted.c: add ext2fs_check_mount_point() function, which will optionally return the mount point of a device if mounted ChangeLog, closefs.c, ext2fs.h: ext2fs.h, closefs.c (ext2fs_flush): Add new flag, EXT2_FLAG_SUPER_ONLY, which the close routines to only update the superblock, and not the group descriptors.bitmap-optimize
parent
cc7067b40b
commit
43ec8734f2
|
@ -1,3 +1,14 @@
|
||||||
|
2001-01-03 <tytso@snap.thunk.org>
|
||||||
|
|
||||||
|
* ext2fs.h, closefs.c (ext2fs_flush): Add new flag,
|
||||||
|
EXT2_FLAG_SUPER_ONLY, which the close routines to only
|
||||||
|
update the superblock, and not the group descriptors.
|
||||||
|
|
||||||
|
2000-12-30 Andreas Dilger <adilger@turbolinux.com>
|
||||||
|
|
||||||
|
* ismounted.c: add ext2fs_check_mount_point() function, which will
|
||||||
|
optionally return the mount point of a device if mounted
|
||||||
|
|
||||||
2000-12-14 Andreas Dilger <adilger@turbolinux.com>
|
2000-12-14 Andreas Dilger <adilger@turbolinux.com>
|
||||||
|
|
||||||
* mkjournal.c: rename ext2fs_add_journal_fs() to the more descriptive
|
* mkjournal.c: rename ext2fs_add_journal_fs() to the more descriptive
|
||||||
|
|
|
@ -209,6 +209,8 @@ errcode_t ext2fs_flush(ext2_filsys fs)
|
||||||
if (retval)
|
if (retval)
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
if (fs->flags & EXT2_FLAG_SUPER_ONLY)
|
||||||
|
goto next_group;
|
||||||
group_ptr = (char *) group_shadow;
|
group_ptr = (char *) group_shadow;
|
||||||
for (j=0; j < fs->desc_blocks; j++) {
|
for (j=0; j < fs->desc_blocks; j++) {
|
||||||
retval = io_channel_write_blk(fs->io,
|
retval = io_channel_write_blk(fs->io,
|
||||||
|
|
|
@ -171,6 +171,7 @@ typedef struct ext2_file *ext2_file_t;
|
||||||
#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
|
#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
|
||||||
#define EXT2_FLAG_MASTER_SB_ONLY 0x200
|
#define EXT2_FLAG_MASTER_SB_ONLY 0x200
|
||||||
#define EXT2_FLAG_FORCE 0x400
|
#define EXT2_FLAG_FORCE 0x400
|
||||||
|
#define EXT2_FLAG_SUPER_ONLY 0x800
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special flag in the ext2 inode i_flag field that means that this is
|
* Special flag in the ext2 inode i_flag field that means that this is
|
||||||
|
@ -687,6 +688,8 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
|
||||||
|
|
||||||
/* ismounted.c */
|
/* ismounted.c */
|
||||||
extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
|
extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
|
||||||
|
extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
|
||||||
|
char *mtpt, int mtlen);
|
||||||
|
|
||||||
/* namei.c */
|
/* namei.c */
|
||||||
extern errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name,
|
extern errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name,
|
||||||
|
|
|
@ -39,10 +39,12 @@
|
||||||
|
|
||||||
#ifdef HAVE_MNTENT_H
|
#ifdef HAVE_MNTENT_H
|
||||||
/*
|
/*
|
||||||
* XXX we only check to see if the mount is readonly when it's the
|
* XXX we assume that /etc/mtab is located on the root filesystem, and
|
||||||
* root filesystem.
|
* we only check to see if the mount is readonly for the root
|
||||||
|
* filesystem.
|
||||||
*/
|
*/
|
||||||
static errcode_t check_mntent(const char *file, int *mount_flags)
|
static errcode_t check_mntent(const char *file, int *mount_flags,
|
||||||
|
char *mtpt, int mtlen)
|
||||||
{
|
{
|
||||||
FILE * f;
|
FILE * f;
|
||||||
struct mntent * mnt;
|
struct mntent * mnt;
|
||||||
|
@ -68,12 +70,15 @@ static errcode_t check_mntent(const char *file, int *mount_flags)
|
||||||
} else
|
} else
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
if (mtpt)
|
||||||
|
strncpy(mtpt, mnt->mnt_dir, mtlen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GETMNTINFO
|
#ifdef HAVE_GETMNTINFO
|
||||||
static errcode_t check_getmntinfo(const char *file, int *mount_flags)
|
static errcode_t check_getmntinfo(const char *file, int *mount_flags,
|
||||||
|
char *mtpt, int mtlen)
|
||||||
{
|
{
|
||||||
struct statfs *mp;
|
struct statfs *mp;
|
||||||
int len, n;
|
int len, n;
|
||||||
|
@ -102,12 +107,40 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags)
|
||||||
}
|
}
|
||||||
++mp;
|
++mp;
|
||||||
}
|
}
|
||||||
|
if (mtpt)
|
||||||
|
strncpy(mtpt, mp->f_mntonname, mtlen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_GETMNTINFO */
|
#endif /* HAVE_GETMNTINFO */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is_mounted is set to 1 if the device is mounted, 0 otherwise
|
* ext2fs_check_mount_point() returns 1 if the device is mounted, 0
|
||||||
|
* otherwise. If mtpt is non-NULL, the directory where the device is
|
||||||
|
* mounted is copied to where mtpt is pointing, up to mtlen
|
||||||
|
* characters.
|
||||||
|
*/
|
||||||
|
#ifdef __TURBOC__
|
||||||
|
#pragma argsused
|
||||||
|
#endif
|
||||||
|
errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
|
||||||
|
char *mtpt, int mtlen)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MNTENT_H
|
||||||
|
return check_mntent(device, mount_flags, mtpt, mtlen);
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_GETMNTINFO
|
||||||
|
return check_getmntinfo(device, mount_flags, mtpt, mtlen);
|
||||||
|
#else
|
||||||
|
*mount_flags = 0;
|
||||||
|
return 0;
|
||||||
|
#endif /* HAVE_GETMNTINFO */
|
||||||
|
#endif /* HAVE_MNTENT_H */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED and
|
||||||
|
* EXT2_MF_READONLY
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef __TURBOC__
|
#ifdef __TURBOC__
|
||||||
#pragma argsused
|
#pragma argsused
|
||||||
|
@ -115,10 +148,10 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags)
|
||||||
errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
|
errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MNTENT_H
|
#ifdef HAVE_MNTENT_H
|
||||||
return check_mntent(file, mount_flags);
|
return check_mntent(file, mount_flags, NULL, 0);
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_GETMNTINFO
|
#ifdef HAVE_GETMNTINFO
|
||||||
return check_getmntinfo(file, mount_flags);
|
return check_getmntinfo(file, mount_flags, NULL, 0);
|
||||||
#else
|
#else
|
||||||
*mount_flags = 0;
|
*mount_flags = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue