Skip to contentSkip to conversation

removal of unused private.h from libsemanage

PATCH In review Caleb Case 3 participants 3 messages Oct 5, 2006 – Oct 13, 2006 SELinux security module

lore
Share & tools
lore

Caleb Case

author
#0 lore raw

PATCH 1/1 removal of unused private.h from libsemanage

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)
libsemanage/src/private.h deleted +0 -72
Index: selinux-pms-support/libsemanage/src/private.h
===================================================================
@@ -1,72 +0,0 @@
-/* Private definitions for libsemod. */
-
-/* Endian conversion for reading and writing binary policies */
-
-#include <byteswap.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#define cpu_to_le64(x) (x)
-#define le64_to_cpu(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define le64_to_cpu(x) bswap_64(x)
-#endif
-
-/* Read from a policy "file" and return a pointer to the requested set
-   of bytes.  Do *NOT* free the returned pointer.  Returns NULL if the
-   requested number of bytes is larger than the read buffer or if an
-   I/O error occurred.  Note that this function is thread-safe. */
-static inline void *next_entry(struct policy_file *fp, size_t bytes)
-{
-	size_t nread;
-
-	if (bytes > sizeof(fp->buffer))
-		return NULL;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		nread = fread(fp->buffer, bytes, 1, fp->fp);
-		if (nread != 1)
-			return NULL;
-		break;
-	case PF_USE_MEMORY:
-		if (bytes > fp->len)
-			return NULL;
-		memcpy(fp->buffer, fp->data, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		break;
-	default:
-		return NULL;
-	}
-	return fp->buffer;
-}
-
-static inline size_t put_entry(const void *ptr, size_t size, size_t n,
-			       struct policy_file *fp)
-{
-	size_t bytes = size * n;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		return fwrite(ptr, size, n, fp->fp);
-	case PF_USE_MEMORY:
-		if (bytes > fp->len) {
-			errno = ENOSPC;
-			return 0;
-		}
-
-		memcpy(fp->data, ptr, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		return n;
-	default:
-		return 0;
-	}
-	return 0;
-}

--

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)
libsemanage/src/private.h deleted +0 -72

72 lines not on this page · raw message

--

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 2 lines · Caleb Case

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

Did this get lost in the labeled network oblivion?

Quoted 171 lines
---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)

Index: selinux-pms-support/libsemanage/src/private.h
===================================================================

libsemanage/src/private.h deleted +0 -73
@@ -1,72 +0,0 @@
-/* Private definitions for libsemod. */
-
-/* Endian conversion for reading and writing binary policies */
-
-#include <byteswap.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#define cpu_to_le64(x) (x)
-#define le64_to_cpu(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define le64_to_cpu(x) bswap_64(x)
-#endif
-
-/* Read from a policy "file" and return a pointer to the requested set
-   of bytes.  Do *NOT* free the returned pointer.  Returns NULL if the
-   requested number of bytes is larger than the read buffer or if an
-   I/O error occurred.  Note that this function is thread-safe. */
-static inline void *next_entry(struct policy_file *fp, size_t bytes)
-{
-	size_t nread;
-
-	if (bytes > sizeof(fp->buffer))
-		return NULL;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		nread = fread(fp->buffer, bytes, 1, fp->fp);
-		if (nread != 1)
-			return NULL;
-		break;
-	case PF_USE_MEMORY:
-		if (bytes > fp->len)
-			return NULL;
-		memcpy(fp->buffer, fp->data, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		break;
-	default:
-		return NULL;
-	}
-	return fp->buffer;
-}
-
-static inline size_t put_entry(const void *ptr, size_t size, size_t n,
-			       struct policy_file *fp)
-{
-	size_t bytes = size * n;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		return fwrite(ptr, size, n, fp->fp);
-	case PF_USE_MEMORY:
-		if (bytes > fp->len) {
-			errno = ENOSPC;
-			return 0;
-		}
-
-		memcpy(fp->data, ptr, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		return n;
-	default:
-		return 0;
-	}
-	return 0;
-}
 
--

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)

Index: selinux-pms-support/libsemanage/src/private.h
===================================================================

libsemanage/src/private.h deleted +0 -73
@@ -1,72 +0,0 @@
-/* Private definitions for libsemod. */
-
-/* Endian conversion for reading and writing binary policies */
-
-#include <byteswap.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#define cpu_to_le64(x) (x)
-#define le64_to_cpu(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define le64_to_cpu(x) bswap_64(x)
-#endif
-
-/* Read from a policy "file" and return a pointer to the requested set
-   of bytes.  Do *NOT* free the returned pointer.  Returns NULL if the
-   requested number of bytes is larger than the read buffer or if an
-   I/O error occurred.  Note that this function is thread-safe. */
-static inline void *next_entry(struct policy_file *fp, size_t bytes)
-{
-	size_t nread;
-
-	if (bytes > sizeof(fp->buffer))
-		return NULL;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		nread = fread(fp->buffer, bytes, 1, fp->fp);
-		if (nread != 1)
-			return NULL;
-		break;
-	case PF_USE_MEMORY:
-		if (bytes > fp->len)
-			return NULL;
-		memcpy(fp->buffer, fp->data, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		break;
-	default:
-		return NULL;
-	}
-	return fp->buffer;
-}
-
-static inline size_t put_entry(const void *ptr, size_t size, size_t n,
-			       struct policy_file *fp)
-{
-	size_t bytes = size * n;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		return fwrite(ptr, size, n, fp->fp);
-	case PF_USE_MEMORY:
-		if (bytes > fp->len) {
-			errno = ENOSPC;
-			return 0;
-		}
-
-		memcpy(fp->data, ptr, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		return n;
-	default:
-		return 0;
-	}
-	return 0;
-}
 
--
Quoted 8 lines

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 175 lines · Joshua Brindle
Quoted 2 lines · Caleb Case

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

Did this get lost in the labeled network oblivion?

Quoted 169 lines
---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)

Index: selinux-pms-support/libsemanage/src/private.h
===================================================================

libsemanage/src/private.h deleted +0 -73
@@ -1,72 +0,0 @@
-/* Private definitions for libsemod. */
-
-/* Endian conversion for reading and writing binary policies */
-
-#include <byteswap.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#define cpu_to_le64(x) (x)
-#define le64_to_cpu(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define le64_to_cpu(x) bswap_64(x)
-#endif
-
-/* Read from a policy "file" and return a pointer to the requested set
-   of bytes.  Do *NOT* free the returned pointer.  Returns NULL if the
-   requested number of bytes is larger than the read buffer or if an
-   I/O error occurred.  Note that this function is thread-safe. */
-static inline void *next_entry(struct policy_file *fp, size_t bytes)
-{
-	size_t nread;
-
-	if (bytes > sizeof(fp->buffer))
-		return NULL;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		nread = fread(fp->buffer, bytes, 1, fp->fp);
-		if (nread != 1)
-			return NULL;
-		break;
-	case PF_USE_MEMORY:
-		if (bytes > fp->len)
-			return NULL;
-		memcpy(fp->buffer, fp->data, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		break;
-	default:
-		return NULL;
-	}
-	return fp->buffer;
-}
-
-static inline size_t put_entry(const void *ptr, size_t size, size_t n,
-			       struct policy_file *fp)
-{
-	size_t bytes = size * n;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		return fwrite(ptr, size, n, fp->fp);
-	case PF_USE_MEMORY:
-		if (bytes > fp->len) {
-			errno = ENOSPC;
-			return 0;
-		}
-
-		memcpy(fp->data, ptr, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		return n;
-	default:
-		return 0;
-	}
-	return 0;
-}
 
--

The header libsemanage/src/private.h is no longer used and should be removed. It appears to be left over from the libsemod days.

---
 libsemanage/src/private.h |   72 ----------------------------------------------
 1 file changed, 72 deletions(-)

Index: selinux-pms-support/libsemanage/src/private.h
===================================================================

libsemanage/src/private.h deleted +0 -72
@@ -1,72 +0,0 @@
-/* Private definitions for libsemod. */
-
-/* Endian conversion for reading and writing binary policies */
-
-#include <byteswap.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#define cpu_to_le64(x) (x)
-#define le64_to_cpu(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define le64_to_cpu(x) bswap_64(x)
-#endif
-
-/* Read from a policy "file" and return a pointer to the requested set
-   of bytes.  Do *NOT* free the returned pointer.  Returns NULL if the
-   requested number of bytes is larger than the read buffer or if an
-   I/O error occurred.  Note that this function is thread-safe. */
-static inline void *next_entry(struct policy_file *fp, size_t bytes)
-{
-	size_t nread;
-
-	if (bytes > sizeof(fp->buffer))
-		return NULL;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		nread = fread(fp->buffer, bytes, 1, fp->fp);
-		if (nread != 1)
-			return NULL;
-		break;
-	case PF_USE_MEMORY:
-		if (bytes > fp->len)
-			return NULL;
-		memcpy(fp->buffer, fp->data, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		break;
-	default:
-		return NULL;
-	}
-	return fp->buffer;
-}
-
-static inline size_t put_entry(const void *ptr, size_t size, size_t n,
-			       struct policy_file *fp)
-{
-	size_t bytes = size * n;
-
-	switch (fp->type) {
-	case PF_USE_STDIO:
-		return fwrite(ptr, size, n, fp->fp);
-	case PF_USE_MEMORY:
-		if (bytes > fp->len) {
-			errno = ENOSPC;
-			return 0;
-		}
-
-		memcpy(fp->data, ptr, bytes);
-		fp->data += bytes;
-		fp->len -= bytes;
-		return n;
-	default:
-		return 0;
-	}
-	return 0;
-}
Quoted 3 lines
Quoted 3 lines

--

(feel free to merge; trivial fix)

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.