lib: move fopen_at() to fileutils.h, remove at.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
parent
2208b3ccb2
commit
1a048dc5e2
|
@ -1,7 +1,6 @@
|
|||
|
||||
dist_noinst_HEADERS += \
|
||||
include/all-io.h \
|
||||
include/at.h \
|
||||
include/bitops.h \
|
||||
include/blkdev.h \
|
||||
include/canonicalize.h \
|
||||
|
|
22
include/at.h
22
include/at.h
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* wrappers for "at" functions.
|
||||
*
|
||||
* Copyright (C) 2010 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This file may be redistributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
*/
|
||||
#ifndef UTIL_LINUX_AT_H
|
||||
#define UTIL_LINUX_AT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "c.h"
|
||||
|
||||
extern FILE *fopen_at(int dir, const char *filename,
|
||||
int flags, const char *mode);
|
||||
|
||||
#endif /* UTIL_LINUX_AT_H */
|
|
@ -28,6 +28,16 @@ static inline FILE *xfmkstemp(char **tmpname, const char *dir, const char *prefi
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline FILE *fopen_at(int dir, const char *filename,
|
||||
int flags, const char *mode)
|
||||
{
|
||||
int fd = openat(dir, filename, flags);
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
|
||||
return fdopen(fd, mode);
|
||||
}
|
||||
|
||||
static inline int is_same_inode(const int fd, const struct stat *st)
|
||||
{
|
||||
struct stat f;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
noinst_LTLIBRARIES += libcommon.la
|
||||
libcommon_la_CFLAGS = $(AM_CFLAGS)
|
||||
libcommon_la_SOURCES = \
|
||||
lib/at.c \
|
||||
lib/blkdev.c \
|
||||
lib/canonicalize.c \
|
||||
lib/crc32.c \
|
||||
|
@ -100,7 +99,7 @@ test_colors_LDADD = $(LDADD) $(TINFO_LIBS)
|
|||
test_randutils_SOURCES = lib/randutils.c
|
||||
test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
||||
|
||||
test_procutils_SOURCES = lib/procutils.c lib/at.c
|
||||
test_procutils_SOURCES = lib/procutils.c
|
||||
test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
||||
|
||||
if LINUX
|
||||
|
|
24
lib/at.c
24
lib/at.c
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Portable xxxat() functions.
|
||||
*
|
||||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Written by Karel Zak <kzak@redhat.com>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "at.h"
|
||||
#include "c.h"
|
||||
|
||||
FILE *fopen_at(int dir, const char *filename, int flags,
|
||||
const char *mode)
|
||||
{
|
||||
int fd = openat(dir, filename, flags);
|
||||
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
|
||||
return fdopen(fd, mode);
|
||||
}
|
|
@ -24,7 +24,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "procutils.h"
|
||||
#include "at.h"
|
||||
#include "fileutils.h"
|
||||
#include "all-io.h"
|
||||
#include "c.h"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "at.h"
|
||||
#include "fileutils.h"
|
||||
#include "mangle.h"
|
||||
#include "mountP.h"
|
||||
#include "pathnames.h"
|
||||
|
|
Loading…
Reference in New Issue