Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4300064e...
Commit: 4300064eccf5568e2d69e156af7d92bf9cac8368
Parent: efd06c888ff3bbf1a7076b3283bf1f0bfa51be1c
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 27 12:27:50 2014 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Mon Jan 27 12:27:50 2014 +0000
gfs2-utils: Clean up unused functions
Remove unused functions, some of which call exit() from libgfs2.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/Makefile.am | 4 +-
gfs2/fsck/eattr.c | 63 ------------------------------------------------
gfs2/fsck/eattr.h | 18 -------------
gfs2/fsck/pass2.c | 1 -
gfs2/libgfs2/fs_ops.c | 18 -------------
gfs2/libgfs2/gfs1.c | 14 ----------
gfs2/libgfs2/libgfs2.h | 4 ---
gfs2/libgfs2/misc.c | 28 ---------------------
8 files changed, 2 insertions(+), 148 deletions(-)
diff --git a/gfs2/fsck/Makefile.am b/gfs2/fsck/Makefile.am
index b92c745..92d56f3 100644
--- a/gfs2/fsck/Makefile.am
+++ b/gfs2/fsck/Makefile.am
@@ -10,10 +10,10 @@ sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' =
/usr:/usr/sbin \
sbin_PROGRAMS = fsck.gfs2
-noinst_HEADERS = eattr.h fsck.h fs_recovery.h \
+noinst_HEADERS = fsck.h fs_recovery.h \
inode_hash.h link.h lost_n_found.h metawalk.h util.h
-fsck_gfs2_SOURCES = eattr.c fs_recovery.c initialize.c \
+fsck_gfs2_SOURCES = fs_recovery.c initialize.c \
inode_hash.c link.c lost_n_found.c main.c metawalk.c \
pass1b.c pass1.c pass1c.c pass2.c pass3.c pass4.c \
pass5.c rgrepair.c util.c
diff --git a/gfs2/fsck/eattr.c b/gfs2/fsck/eattr.c
deleted file mode 100644
index 3f95d93..0000000
--- a/gfs2/fsck/eattr.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "clusterautoconfig.h"
-
-#include <stdint.h>
-#include <string.h>
-#include <libintl.h>
-#define _(String) gettext(String)
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "metawalk.h"
-#include "eattr.h"
-
-int clear_eattr_entry (struct gfs2_inode *ip,
- struct gfs2_buffer_head *leaf_bh,
- struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev,
- void *private)
-{
- struct gfs2_sbd *sdp = ip->i_sbd;
-
- if (!ea_hdr->ea_name_len){
- /* Skip this entry for now */
- return 1;
- }
-
- if (!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
- ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
- /* Skip invalid entry */
- return 1;
- }
-
- if (ea_hdr->ea_num_ptrs){
- uint32_t avail_size;
- int max_ptrs;
-
- avail_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
- max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size;
-
- if (max_ptrs > ea_hdr->ea_num_ptrs) {
- return 1;
- } else {
- log_debug( _(" Pointers Required: %d\n"
- " Pointers Reported: %d\n"),
- max_ptrs, ea_hdr->ea_num_ptrs);
- }
-
-
- }
- return 0;
-}
-
-int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
- struct gfs2_buffer_head *leaf_bh,
- struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev, void *private)
-{
- uint64_t block = be64_to_cpu(*ea_data_ptr);
-
- return delete_eattr_leaf(ip, block, 0, &leaf_bh, private);
-}
-
-
-
diff --git a/gfs2/fsck/eattr.h b/gfs2/fsck/eattr.h
deleted file mode 100644
index f4264b0..0000000
--- a/gfs2/fsck/eattr.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _EATTR_H
-#define _EATTR_H
-
-int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh, void *private);
-int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh, void *private);
-int clear_eattr_entry (struct gfs2_inode *ip,
- struct gfs2_buffer_head *leaf_bh,
- struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev,
- void *private);
-int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
- struct gfs2_buffer_head *leaf_bh,
- struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev, void *private);
-
-#endif /* _EATTR_H */
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 26f7d48..d3b56fc 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -12,7 +12,6 @@
#include "libgfs2.h"
#include "fsck.h"
#include "util.h"
-#include "eattr.h"
#include "metawalk.h"
#include "link.h"
#include "lost_n_found.h"
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 7a6f57a..e00bd1f 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -835,24 +835,6 @@ void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
*leaf_out = be64_to_cpu(leaf_no);
}
-void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
-{
- uint64_t leaf_no;
- int count;
-
- if (dip->i_sbd->gfs1) {
- gfs_put_leaf_nr(dip, inx, leaf_out);
- return;
- }
- leaf_no = cpu_to_be64(leaf_out);
- count = gfs2_writei(dip, (char *)&leaf_no, inx * sizeof(uint64_t),
- sizeof(uint64_t));
- if (count != sizeof(uint64_t)) {
- fprintf(stderr, "gfs2_put_leaf_nr: Bad internal write.\n");
- exit(1);
- }
-}
-
void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
struct gfs2_buffer_head *obh)
{
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 8c8ca91..c00d7be 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -389,17 +389,3 @@ void gfs_rgrp_out(struct gfs_rgrp *rgrp, struct gfs2_buffer_head
*rbh)
memcpy(str->rg_reserved, rgrp->rg_reserved, 64);
bmodified(rbh);
}
-
-void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
-{
- uint64_t leaf_no;
- int count;
-
- leaf_no = cpu_to_be64(leaf_out);
- count = gfs1_writei(dip, (char *)&leaf_no, inx * sizeof(uint64_t),
- sizeof(uint64_t));
- if (count != sizeof(uint64_t)) {
- fprintf(stderr, "gfs_put_leaf_nr: Bad internal write.\n");
- exit(1);
- }
-}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 084ef41..71adb30 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -481,7 +481,6 @@ extern void block_map(struct gfs2_inode *ip, uint64_t lblock, int
*new,
uint64_t *dblock, uint32_t *extlen, int prealloc);
extern void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
uint64_t *leaf_out);
-extern void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out);
extern void dir_split_leaf(struct gfs2_inode *dip, uint32_t start,
uint64_t leaf_no, struct gfs2_buffer_head *obh);
extern void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block);
@@ -670,8 +669,6 @@ extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp,
extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
extern void gfs_rgrp_in(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
extern void gfs_rgrp_out(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
-extern void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx,
- uint64_t leaf_out);
/* gfs2_log.c */
@@ -721,7 +718,6 @@ extern int find_gfs2_meta(struct gfs2_sbd *sdp);
extern int dir_exists(const char *dir);
extern int mount_gfs2_meta(struct gfs2_sbd *sdp);
extern void cleanup_metafs(struct gfs2_sbd *sdp);
-extern int set_sysfs(const char *fsname, const char *filename, const char *val);
extern int is_fsname(char *name);
extern void get_random_bytes(void *buf, int nbytes);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 8ee8324..d34b8a5 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -23,7 +23,6 @@
#include "libgfs2.h"
#define PAGE_SIZE (4096)
-#define SYS_BASE "/sys/fs/gfs2" /* FIXME: Look in /proc/mounts to find this */
#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
int metafs_interrupted = 0;
@@ -278,33 +277,6 @@ void cleanup_metafs(struct gfs2_sbd *sdp)
metafs_interrupted = 0;
}
-int set_sysfs(const char *fsname, const char *filename, const char *val)
-{
- char path[PATH_MAX];
- int fd, rv, len;
-
- len = strlen(val) + 1;
- if (len > PAGE_SIZE) {
- errno = EINVAL;
- return -1;
- }
-
- memset(path, 0, PATH_MAX);
- snprintf(path, PATH_MAX - 1, "%s/%s/%s", SYS_BASE, fsname, filename);
-
- fd = open(path, O_WRONLY);
- if (fd < 0)
- return -1;
-
- rv = write(fd, val, len);
- if (rv != len) {
- close(fd);
- return -1;
- }
- close(fd);
- return 0;
-}
-
/*
* get_random_bytes - Generate a series of random bytes using /dev/urandom.
*