From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs/libgfs Makefile libgfs.h size.c gf ...
Date: 10 Jul 2006 23:28:12 -0000 [thread overview]
Message-ID: <20060710232812.24826.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-07-10 23:28:11
Modified files:
gfs/libgfs : Makefile libgfs.h
Added files:
gfs/libgfs : size.c
Removed files:
gfs/libgfs : gfs_ondisk.h missing
Log message:
Changes necessary due to removal of iddev parts (replaced by libvolume_id)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/size.c.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/libgfs.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/gfs_ondisk.h.diff?cvsroot=cluster&r1=1.1&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/missing.diff?cvsroot=cluster&r1=1.1&r2=NONE
/cvs/cluster/cluster/gfs/libgfs/size.c,v --> standard output
revision 1.1
--- cluster/gfs/libgfs/size.c
+++ - 2006-07-10 23:28:11.582177000 +0000
@@ -0,0 +1,94 @@
+/******************************************************************************
+*******************************************************************************
+**
+** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
+** Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+**
+** This copyrighted material is made available to anyone wishing to use,
+** modify, copy, or redistribute it subject to the terms and conditions
+** of the GNU General Public License v.2.
+**
+*******************************************************************************
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/mount.h>
+
+#include "libgfs.h"
+
+#ifndef BLKGETSIZE64
+#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
+#endif
+
+/**
+ * do_device_size - determine the size of a Linux block device
+ * @device: the path to the device node
+ *
+ * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
+ */
+
+static int
+do_device_size(int fd, uint64_t *bytes)
+{
+ unsigned long size;
+ off_t off;
+ int error;
+
+ error = ioctl(fd, BLKGETSIZE64, bytes); /* Size in bytes */
+ if (!error)
+ return 0;
+
+ error = ioctl(fd, BLKGETSIZE, &size); /* Size in 512-byte blocks */
+ if (!error) {
+ *bytes = ((uint64_t) size) << 9;
+ return 0;
+ }
+
+ off = lseek(fd, 0, SEEK_END);
+ if (off >= 0) {
+ *bytes = off;
+ return 0;
+ }
+
+ return -1;
+}
+
+/**
+ * device_size - figure out a device's size
+ * @fd: the file descriptor of a device
+ * @bytes: the number of bytes the device holds
+ *
+ * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
+ */
+
+int
+device_size(int fd, uint64_t *bytes)
+{
+ struct stat st;
+ int error;
+
+ error = fstat(fd, &st);
+ if (error)
+ return error;
+
+ if (S_ISREG(st.st_mode)) {
+ *bytes = st.st_size;
+ return 0;
+ } else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))
+ return do_device_size(fd, bytes);
+ else if (S_ISDIR(st.st_mode))
+ errno = EISDIR;
+ else
+ errno = EINVAL;
+
+ return -1;
+}
--- cluster/gfs/libgfs/Makefile 2006/05/15 18:56:07 1.1
+++ cluster/gfs/libgfs/Makefile 2006/07/10 23:28:11 1.2
@@ -17,7 +17,7 @@
include ${top_srcdir}/make/defines.mk
LIBGFS=libgfs.a
-INCLUDEPATH=-I${top_srcdir}/include -I${top_srcdir}/config -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
+INCLUDEPATH=-I${top_srcdir}/include -I${top_srcdir}/config -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/ -I${gfskincdir}
INSTALL=install
CC=gcc -c
@@ -27,7 +27,7 @@
H=gfs_ondisk.h incore.h libgfs.h
C=bio.c bitmap.c block_list.c file.c fs_bits.c fs_bmap.c fs_dir.c \
- fs_inode.c inode.c log.c ondisk.c rgrp.c super.c util.c
+ fs_inode.c inode.c log.c ondisk.c rgrp.c size.c super.c util.c
O=$(subst .c,.o,${C})
all: ${LIBGFS}
--- cluster/gfs/libgfs/libgfs.h 2006/05/15 18:56:07 1.1
+++ cluster/gfs/libgfs/libgfs.h 2006/07/10 23:28:11 1.2
@@ -260,6 +260,11 @@
uint64 *dblock, uint32 *extlen);
/* ------------------------------------------------------------------------- */
+/* formerly iddev.h */
+/* ------------------------------------------------------------------------- */
+int device_size(int fd, uint64_t *bytes);
+
+/* ------------------------------------------------------------------------- */
/* formerly util.h: */
/* ------------------------------------------------------------------------- */
#define do_lseek(fd, off) \
@@ -328,7 +333,6 @@
int fs_copyin_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip, osi_buf_t *bh);
int fs_copyout_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip);
int fs_mkdir(int disk_fd, struct gfs_inode *dip, char *new_dir, int mode, struct gfs_inode **nip);
-int fs_remove(struct gfs_inode *ip);
static __inline__ int fs_is_stuffed(struct gfs_inode *ip)
{
reply other threads:[~2006-07-10 23:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060710232812.24826.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.