Hello community, here is the log from the commit of package librtas for openSUSE:Factory checked in at Wed Nov 25 16:18:20 CET 2009. -------- --- librtas/librtas.changes 2008-11-05 16:47:27.000000000 +0100 +++ /mounts/work_src_done/STABLE/librtas/librtas.changes 2009-11-20 15:34:01.000000000 +0100 @@ -1,0 +2,7 @@ +Fri Nov 20 14:45:45 CET 2009 - uli@suse.de + +- update -> 1.3.4: + - new inventory model (fate#304149) + - support rtas event updates (fate#307049) + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- librtas-1.3.3.tar.bz2 librtas.firmware_rev.patch librtas.header-compile.patch librtas.open_create.patch librtas.open_prop_file-off_by_one.patch New: ---- librtas-1.3.4.tar.bz2 librtas-failedmagic.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librtas.spec ++++++ --- /var/tmp/diff_new_pack.bt7dIk/_old 2009-11-25 16:17:19.000000000 +0100 +++ /var/tmp/diff_new_pack.bt7dIk/_new 2009-11-25 16:17:19.000000000 +0100 @@ -1,7 +1,7 @@ # -# spec file for package librtas (Version 1.3.3) +# spec file for package librtas (Version 1.3.4) # -# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,19 +20,16 @@ Name: librtas BuildRequires: doxygen -Version: 1.3.3 -Release: 39 +Version: 1.3.4 +Release: 1 Group: System/Libraries -License: IBM Public License +License: IBM Public License .. Summary: Libraries to provide access to RTAS calls and RTAS events BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: ppc ppc64 Url: http://librtas.ozlabs.org/ Source0: http://librtas.ozlabs.org/downloads/librtas-%{version}.tar.bz2 -Patch0: librtas.open_prop_file-off_by_one.patch -Patch2: librtas.open_create.patch -Patch3: librtas.firmware_rev.patch -Patch4: librtas.header-compile.patch +Patch: librtas-failedmagic.patch %description The librtas shared library provides userspace with an interface through @@ -54,10 +51,8 @@ %prep %setup -q -%patch0 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 +%patch +sed s,rtasevent,ofdt,g <doxygen.rtasevent >doxygen.ofdt %build make CFLAGS="$RPM_OPT_FLAGS -fPIC -g -I $PWD/librtasevent_src" LIB_DIR="%{_libdir}" %{?jobs:-j%jobs} ++++++ librtas-1.3.3.tar.bz2 -> librtas-1.3.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/Changelog new/librtas-1.3.4/Changelog --- old/librtas-1.3.3/Changelog 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/Changelog 2009-05-19 00:42:31.000000000 +0200 @@ -1,3 +1,12 @@ +Changelog for librtas-1.3.4 +======================================= + - Several minor fixes from Olaf Hering; use correct open mode for O_CREAT, + fix out-of-bounds access in parse_post_scn() and alloc the trailing null + in open_prop_file(). + - Update rules.mk to install 64-bit libraries to /usr/lib64 + - Update librtasevent for recent PAPR+ updates. + - Add libofdt + Changelog for librtas-1.3.3 ======================================= - Changed ibm,get-vpd call to reuse the same RMO buffer for both diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/common.h new/librtas-1.3.4/libofdt_src/common.h --- old/librtas-1.3.3/libofdt_src/common.h 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/common.h 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,60 @@ +/** + * @file common.h + * + * Copyright (C) 2008/2009 IBM Corporation + * Common Public License Version 1.0 (see COPYRIGHT) + * + * @author Manish Ahuja mahuja@us.ibm.com + */ +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include "libofdt.h" + +#define DRC_STR_MAX 48 +#define OFDT_BASE "/proc/device-tree" + +struct delete_struct { + struct delete_struct *next; + struct node *dnode; + struct property *dprop; +}; + +struct dr_connector { + char name[DRC_STR_MAX]; + char type[DRC_STR_MAX]; + unsigned int index; + unsigned int powerdomain; + struct dr_connector *next; +}; + +struct of_list_prop { + char *_data; + char *val; + int n_entries; +}; + +struct drc_prop_grp { + struct of_list_prop drc_names; + struct of_list_prop drc_types; + struct of_list_prop drc_indexes; + struct of_list_prop drc_domains; +}; + +struct dr_connector *get_drc_info(const char *); +void free_drc_info(struct dr_connector *); +char *of_to_full_path(const char *); +struct dr_connector *find_drc_info(const char *); +int file_exists(const char *, const char *); +void create_drc_properties(struct node *, struct dr_connector *); +void add_property(struct node *, const char *, char *); + +static inline void *zalloc(int sz) { + void *tmp = malloc(sz); + if (tmp) + memset(tmp, 0, sz); + + return tmp; +} + +#endif /* COMMON_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/drc.c new/librtas-1.3.4/libofdt_src/drc.c --- old/librtas-1.3.3/libofdt_src/drc.c 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/drc.c 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,327 @@ +/** + * @file drc.c + * @brief Common routines for building DRC Info. + * @author Borrowed/Adapted code from drmgr authored by "Nathan Fontenont". + * @author Manish Ahuja mahuja@us.ibm.com + * + * Copyright (C) IBM Corporation 2009 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <dirent.h> +#include <stdint.h> +#include "common.h" + +/** + * get_property + * @brief retrieve a device-tree property from /proc + * + * @param path path to the property to retrieve + * @param name name of the property to retrieve + * @param prop of_list_prop to retrieve property for + * @returns 0 on success, !0 otherwise + */ +static int get_property(const char *path, const char *property, + void *buf, int buf_sz) +{ + FILE *fp; + int rc; + char dir[OFDT_MAX_PATH]; + + if ((path == NULL) || (property == NULL)) + return -1; + + sprintf(dir, "%s/%s", path, property); + fp = fopen(dir, "r"); + if (fp == NULL) + return -1; + + rc = fread(buf, buf_sz, 1, fp); + + fclose(fp); + return 0; +} + +/** + * get_proprety_size + * @brief Retrieve the size of a device tree property + * + * @param path full path to property + * @param name property name + * @returns size of property + */ +static int get_property_size(const char *path, const char *name) +{ + char file_path[OFDT_MAX_PATH]; + struct stat sb; + int rc; + + sprintf(file_path, "%s/%s", path, name); + rc = stat(file_path, &sb); + + return sb.st_size; +} + +/** + * get_of_list_prop + * @breif retrieve the specified open firmware property list + * + * @param full_path + * @param prop_name + * @param prop + * @returns 0 on success, !0 otherwise + */ +static int get_of_list_prop(const char *full_path, char *prop_name, + struct of_list_prop *prop) +{ + int rc, size; + + size = get_property_size(full_path, prop_name); + prop->_data = zalloc(size); + if (prop->_data == NULL) + return -1; + + rc = get_property(full_path, prop_name, prop->_data, size); + if (rc) { + free(prop->_data); + return -1; + } + + prop->n_entries = *(uint *)prop->_data; + prop->val = prop->_data + sizeof(uint); + + return 0; +} + +/** + * get_drc_prop_grp + * + * @param full_path + * @param group + * @returns 0 on success, !0 otherwise + */ +static int get_drc_prop_grp(const char *full_path, struct drc_prop_grp *group) +{ + int rc; + + memset(group, 0, sizeof(*group)); + + rc = get_of_list_prop(full_path, "ibm,drc-names", &group->drc_names); + if (rc) + return rc; + + rc = get_of_list_prop(full_path, "ibm,drc-types", &group->drc_types); + if (rc) + return rc; + + rc = get_of_list_prop(full_path, "ibm,drc-indexes", + &group->drc_indexes); + if (rc) + return rc; + + rc = get_of_list_prop(full_path, "ibm,drc-power-domains", + &group->drc_domains); + if (rc) + return rc; + + return 0; +} + +/** + * free_drc_props + * @brief free the properties associated with a drc group + * + * @param group + */ +static void free_drc_props(struct drc_prop_grp *group) +{ + if (group->drc_names.val) + free(group->drc_names._data); + if (group->drc_types.val) + free(group->drc_types._data); + if (group->drc_indexes.val) + free(group->drc_indexes._data); + if (group->drc_domains.val) + free(group->drc_domains._data); +} + +/** + * build_connectors_group + * + * @param group + * @param n_entries + * @param list + * @returns 0 on success, !0 otherwise + */ +static int build_connectors_list(struct drc_prop_grp *group, int n_entries, + struct dr_connector *list) +{ + struct dr_connector *entry; + unsigned int *index_ptr; + unsigned int *domain_ptr; + char *name_ptr; + char *type_ptr; + int i; + + index_ptr = (unsigned int *)group->drc_indexes.val; + domain_ptr = (unsigned int *)group->drc_domains.val; + name_ptr = group->drc_names.val; + type_ptr = group->drc_types.val; + + for (i = 0; i < n_entries; i++) { + entry = &list[i]; + + entry->index = *(index_ptr++); + entry->powerdomain = *(domain_ptr++); + + strncpy(entry->name, name_ptr, DRC_STR_MAX); + name_ptr += strlen(name_ptr) + 1; + + strncpy(entry->type, type_ptr, DRC_STR_MAX); + type_ptr += strlen(type_ptr) + 1; + + if (i == (n_entries - 1)) + entry->next = NULL; + else + entry->next = &list[i+1]; + } + + return 0; +} + +/** + * get_dr_connectors + * + * NOTE:Callers of this function are expected to free drc_list themselves + * + * @param of_path + * @param drc_list + * @param n_drcs + * @returns 0 on success, !0 otherwise + */ +struct dr_connector *get_drc_info(const char *of_path) +{ + struct dr_connector *list = NULL; + struct of_list_prop *drc_names; + struct drc_prop_grp prop_grp; + int n_drcs; + int rc; + + rc = get_drc_prop_grp(of_path, &prop_grp); + if (rc) + return NULL; + + drc_names = &prop_grp.drc_names; + n_drcs = drc_names->n_entries; + + list = zalloc(n_drcs * sizeof(struct dr_connector)); + if (list) + rc = build_connectors_list(&prop_grp, n_drcs, list); + + free_drc_props(&prop_grp); + return list; +} + +/** + * free_drc_info + * + * @param drc_list + */ +void free_drc_info(struct dr_connector *drc_list) +{ + free(drc_list); +} + +/** + * file_exists + * + * @brief Function that checks whether ibm,my-drc-index exists. + * + * @param path + * @returns 0 on success, !0 otherwise + */ +int file_exists(const char *path, const char *fname) +{ + int rc; + struct stat sb; + char file_path[OFDT_MAX_PATH]; + + sprintf(file_path, "%s/%s", path, fname); + rc = stat(file_path, &sb); + + return !rc; +} + +/** + * create_drc_props + * + * @brief Function that creates drc,type/name/powerdomain. + * + * @param dr_connector + * @param parent node + * @param path + */ +void create_drc_properties(struct node *node, struct dr_connector *drc_list) +{ + char powerdomain[OFDT_MAX_NAME]; + struct dr_connector *drc; + int rc; + uint32_t drc_index; + + if (drc_list == NULL) + return; + + rc = get_property(node->path, "ibm,my-drc-index", &drc_index, + sizeof(drc_index)); + if (rc) + return; + + for (drc = drc_list; drc; drc = drc->next) { + if (drc_index == drc->index) + break; + } + + if (!drc) + return + + add_property(node, "ibm,drc-name", drc->name); + add_property(node, "ibm,drc-type", drc->type); + + sprintf(powerdomain, "%u", drc->powerdomain); + add_property(node, "ibm,drc-powerdomain", powerdomain); +} + +/** + * find_drc_info + * + * @brief Function that parses prev sub-directories until it finds + * ibm,drc-index file + * + * @param path + * @returns dr_connector type. + */ +struct dr_connector *find_drc_info(const char *path) +{ + struct stat sb; + int rc; + char tmp_path[OFDT_MAX_PATH]; + char buf[OFDT_MAX_PATH]; + char *slash; + + sprintf(buf, "%s", path); + + do { + sprintf(tmp_path, "%s/%s", buf, "ibm,drc-indexes"); + rc = stat(buf, &sb); + if (rc == 0) + return get_drc_info(buf); + + slash = strrchr(buf, '/'); + if (slash) + *slash = '\0'; + } while (slash); + + return NULL; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/dtree.c new/librtas-1.3.4/libofdt_src/dtree.c --- old/librtas-1.3.3/libofdt_src/dtree.c 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/dtree.c 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,530 @@ +/** + * @file dtree.c + * + * Copyright (C) 2008/2009 IBM Corporation + * Common Public License Version 1.0 (see COPYRIGHT) + * + * @author Manish Ahuja mahuja@us.ibm.com + */ + +#include "common.h" + +struct node *treehead = NULL; +struct delete_struct *delete_list = NULL; + +void __libofdt_fini() __attribute__((destructor)); + +/** + * allocate_property + * @brief allocates property + * + * @param name + * @param path + * @param value + * @param size + * @return property + */ +static struct property *allocate_property(const char *name, const char *path, + char *value) +{ + struct property *prop; + int rc; + + prop = zalloc(sizeof(*prop)); + if (!prop) + return NULL; + + if (!value) { + FILE *fp; + struct stat sb; + + rc = stat(path, &sb); + if (rc) + return NULL; + + prop->value = zalloc(sb.st_size + 1); + if (prop->value) { + free(prop); + return NULL; + } + + fp = fopen(path, "r"); + if (fp == NULL) { + free(prop); + return NULL; + } + + rc = fread(prop->value, 1, sb.st_size, fp); + fclose(fp); + } else { + int length = strlen(value); + + prop->value = zalloc(length + 1); + if (!prop->value) { + free(prop); + return NULL; + } + + strncpy(prop->value, value, length); + } + + /* struct alredy nulled out, not copying last null */ + strncpy(prop->path, path, strlen(path)); + strncpy(prop->name, name, strlen(name)); + + return prop; +} + +/** + * add_property + * @brief adds property to head of queue and then calls allocate_property + * + * @param name + * @param path + * @param value + * @param size + */ +void add_property(struct node *node, const char *name, char *value) +{ + struct property *prop; + + prop = allocate_property(name, node->path, value); + + prop->next = node->properties; + node->properties = prop; +} + +/** + * allocate_node + * @brief allocates the actual node. + * + * @param parent + * @param path + * @returns node + */ +static struct node *allocate_node(struct node *parent, const char* path) +{ + struct node *node; + + node = zalloc(sizeof(*node)); + if (node == NULL) + return NULL; + + strncpy(node->path, path, strlen(path)); + node->parent = parent; + + return node; +} + +/** + * build_node + * @brief the heart of this library, that builds and creates the whole tree. + * + * @param dirname + * @param parent_node + * @param parent_list + * @returns node + */ +static struct node *build_node(const char *path, + struct dr_connector *my_drc_info) +{ + int rc; + DIR *d; + struct dirent *de; + struct node *node; + char buf[OFDT_MAX_PATH]; + struct dr_connector *child_drc_info; + + /* Check to see if we need to create drc info for any child nodes */ + if (file_exists(path, "ibm,drc-indexes")) + child_drc_info = get_drc_info(path); + else + child_drc_info = my_drc_info; + + node = allocate_node(NULL, path); + if (!node) { + if (child_drc_info != my_drc_info) + free_drc_info(child_drc_info); + + return NULL; + } + + if (file_exists(path, "ibm,my-drc-index")) + create_drc_properties(node, my_drc_info); + + d = opendir(path); + if (!d) { + if (child_drc_info != my_drc_info) + free_drc_info(child_drc_info); + + return NULL; + } + + while((de = readdir(d)) != NULL ) { + struct stat sb; + + sprintf(buf, "%s/%s", path, de->d_name); + rc = stat(buf, &sb); + if (rc) + break; + + if (S_ISDIR(sb.st_mode)) { + struct node *child; + + child = build_node(buf, child_drc_info); + + child->sibling = node->child; + node->child = child; + } else if (S_ISREG(sb.st_mode)) { + add_property(node, de->d_name, NULL); + } + } + + closedir(d); + + if (child_drc_info != my_drc_info) + free_drc_info(child_drc_info); + + return node; +} + +/** + * add_node_to_dl + * @brief Adds nodes to delete list. + * + * @param node to add + */ +static void add_node_to_dl(struct node *to_add) +{ + struct delete_struct *new; + + new = zalloc(sizeof(*new)); + if (!new) + return; + + new->dnode = to_add; + new->next = delete_list; + delete_list = new; +} + +/** + * add_prop_to_dl + * @brief Adds property to delete list. + * + * @param prop to add + */ +static void add_prop_to_dl(struct property *to_add) +{ + struct delete_struct *new; + + new = zalloc(sizeof(*new)); + if (!new) + return; + + new->dprop = to_add; + new->next = delete_list; + delete_list = new; +} + +/** + * delete_properties + * @brief deletes chained properties. + * + * @param prop to add + */ +static void delete_properties(struct node *to_delete) +{ + struct property *tmp, *prop; + prop = to_delete->properties; + + while (prop != NULL) { + tmp = prop; + prop = prop->next; + free(tmp); + } +} + +/** + * remove_node + * @brief removes sub-nodes and nodes recursively. + * + * @param node head. + */ +static void remove_node(struct node *head) +{ + struct node *tmp; + + while ((head->child) || (head->sibling)) { + if (head->child) { + remove_node(head->child); + if (head->sibling == NULL && (head->properties)) { + delete_properties(head); + free(head); + break; + } + } + if (head->sibling) { + if (head->properties) + delete_properties(head); + tmp = head; + head = head->sibling; + free(tmp); + } + } +} + +/** + * delete_node_from_dl + * @brief removes-any nodes being asked to delete. + * + * @param delete_node + */ +static void delete_node_from_dl(struct node *to_delete) +{ + struct delete_struct *tmp, *prev; + + tmp = delete_list; + while (tmp) { + if (tmp->dnode == to_delete) { + remove_node(tmp->dnode); + + if (tmp == delete_list) + delete_list = tmp->next; + else + prev->next = tmp->next; + + free(tmp); + break; + } + + prev = tmp; + tmp = tmp->next; + } +} + +/** + * delete_prop_from_dl + * @brief removes-any properties being asked to delete. + * + * @param delete_prop + */ +static void delete_prop_from_dl(struct property *to_delete) +{ + struct delete_struct *tmp, *prev; + + tmp = delete_list; + while (tmp) { + if (tmp->dprop == to_delete) { + free(tmp->dprop); + + if (tmp == delete_list) + delete_list = tmp->next; + else + prev->next = tmp->next; + + free(tmp); + return; + } + + prev = tmp; + tmp = tmp->next; + } +} + +/** + * base_path + * @brief builds appropriate path and returns it. + * + * The path specified can be either a full path to a device tree, or + * a relative path to the real device tree at /proc/device-tree. NOTE + * that the relative path of NULL implies the base device tree at + * /proc/device-tree + * + * @param dir + */ +static int path_to_full_dtpath(const char *user_path, char *full_path) +{ + struct stat sb; + int rc; + + memset(full_path, 0, OFDT_MAX_PATH); + + if (!user_path) { + /* NULL implies /proc/device-tree */ + sprintf(full_path, "%s", OFDT_BASE); + return 0; + } + + rc = stat(user_path, &sb); + if (rc == 0) { + /* Valid path specified, copy to full path */ + snprintf(full_path, OFDT_MAX_PATH, "%s", user_path); + return 0; + } + + /* build OFDT_BASE/user_path and validate */ + snprintf(full_path, OFDT_MAX_PATH, "%s/%s", OFDT_BASE, user_path); + rc = stat(full_path, &sb); + + return rc; +} + +/** + * ofdt_get + * @brief builds the device tree from the given path. + * + * @param path + * @returns node + */ +struct node *ofdt_get(const char * path) +{ + char full_path[OFDT_MAX_PATH]; + struct dr_connector *drc_info; + struct node *head; + int rc; + + rc = path_to_full_dtpath(path, full_path); + if (rc) + return NULL; + + drc_info = find_drc_info(full_path); + head = build_node(full_path, drc_info); + if (head) + add_node_to_dl(head); + + free_drc_info(drc_info); + return head; +} + +/** + * ofdt_put + * @brief releases the device tree from the given node pointer. + * + * @param path + * @returns node + */ +void ofdt_put(struct node *delete) +{ + delete_node_from_dl(delete); +} + +/** + * ofdt_get_property + * @brief returns the appropriate property pointer from given tree. It takes + * path. + * + * @param node + * @param path + * @returns property + */ +struct property *ofdt_get_property(struct node *node, const char *name) +{ + struct property *prop; + int len = strlen(name); + + for (prop = node->properties; prop; prop = prop->next) { + if (strncmp(prop->name, name, len) == 0) + return prop; + } + + return NULL; +} + +/** + * ofdt_get_property_by_name + * @brief builds and returns the appropriate property pointer from given path. + * + * @param path + * @returns property + */ +struct property * ofdt_get_property_by_name(const char * dir) +{ + struct property *prop; + char *name; + char path[OFDT_MAX_PATH]; + int rc; + + rc = path_to_full_dtpath(dir, path); + if (rc) + return NULL; + + name = strrchr(path, '/'); + if (!name) + return NULL; + + /* move past the '/' character */ + name++; + + prop = allocate_property(name, path, NULL); + add_prop_to_dl(prop); + return prop; +} + +/** + * ofdt_property_put + * @brief Deletes properties from delete list. + * + * @param property + */ +void ofdt_property_put(struct property *to_delete) +{ + delete_prop_from_dl(to_delete); +} + +#ifdef DEBUG +/** + * traverse_devicetree + * @brief Debug function, that prints nodes and properties. + * + * @param node_head + */ +void traverse_devicetree(struct node *head) +{ + struct property *prop; + + while ((head->child) || (head->sibling)) { + if (head->child) { + traverse_devicetree(head->child); + if (head->sibling == NULL) { + printf("NODE name is %s\n", head->path); + for (prop = head->properties; prop != NULL; + prop = prop->next) { + printf("\tProp name is %s path is %s\n", + prop->name, prop->path); + } + break; + } + } + if (head->sibling) { + printf("NODE name is %s\n", head->path); + for (prop = head->properties; prop != NULL; + prop = prop->next) { + printf("\tProp name is %s path is %s\n", + prop->name, prop->path); + } + head = head->sibling; + } + } +} +#endif + +/** + * __libofdt_fini() + * @brief fini routine that cleans everything when library exits. + * + */ +void __libofdt_fini() +{ + struct delete_struct *tmp, *prev; + + tmp = delete_list; + while (tmp) { + prev = tmp; + if (tmp->dnode) + remove_node(tmp->dnode); + if (tmp->dprop) + free(tmp->dprop); + tmp = tmp->next; + free(prev); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/libofdt.h new/librtas-1.3.4/libofdt_src/libofdt.h --- old/librtas-1.3.3/libofdt_src/libofdt.h 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/libofdt.h 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,47 @@ +/** + * @file libofdt.h + * + * Copyright (C) 2008/2009 IBM Corporation + * Common Public License Version 1.0 (see COPYRIGHT) + * + * @author Manish Ahuja mahuja@us.ibm.com + */ + +#ifndef _LIBOFDT_H_ +#define _LIBOFDT_H_ + +#include <stdio.h> +#include <dirent.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <sys/stat.h> + +#define OFDT_MAX_NAME 128 /* Max name length */ +#define OFDT_MAX_PATH 1024 /* Max Path length */ + +struct property { + char name[OFDT_MAX_NAME]; + char path[OFDT_MAX_PATH]; + char *value; + struct property *next; + struct node * parent; +}; + +struct node { + char name[OFDT_MAX_NAME]; + char path[OFDT_MAX_PATH]; + struct property *properties; + struct node *child; + struct node *parent; + struct node *sibling; +}; + +extern struct node *ofdt_get(const char *); +extern void ofdt_put(struct node *); + +extern struct property *ofdt_get_property(struct node *, const char *); +extern struct property *ofdt_get_property_by_name(const char *); +extern void ofdt_property_put(struct property *); + +#endif /* _LIBOFDT_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/Makefile new/librtas-1.3.4/libofdt_src/Makefile --- old/librtas-1.3.3/libofdt_src/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/Makefile 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,38 @@ + +# +# Makefile for librtas +# +# Copyright (C) 2005 IBM Corporation +# Common Public License Version 1.0 (see COPYRIGHT) +# + +include ../rules.mk + +LIBOFDT_SONAME = libofdt.so +LIBOFDT = $(LIBOFDT_SONAME).$(VERSION) + +LIBOFDT_OBJS = dtree.o drc.o + +LIBOFDT_HDR = libofdt.h common.h +HEADERS = $(LIBOFDT_HDR) + +CFLAGS += -fPIC -DPIC +LDFLAGS += -shared -Wl,-soname -Wl,$(LIBOFDT_SONAME).$(MAJOR_NO) + +all: $(LIBOFDT_OBJS) $(HEADERS) + @echo "LD $(WORK_DIR)/$(LIBOFDT)..." + @$(CC) $(LIBOFDT_OBJS) $(LDFLAGS) -o $(LIBOFDT) + +install: + @$(call install_lib,$(LIBOFDT),$(DESTDIR)) + @$(call install_inc,$(LIBOFDT_HDR),$(DESTDIR)) + @ln -sf $(LIBOFDT) $(DESTDIR)/$(LIB_DIR)/$(LIBOFDT_SONAME) + +uninstall: + @$(call uninstall_lib,$(LIBOFDT),$(DESTDIR)) + @$(call uninstall_inc,$(LIBOFDT_HDR),$(DESTDIR)) + @rm -f $(DESTDIR)/$(LIB_DIR)/$(LIBOFDT_SONAME) + +clean: + @echo "Cleaning up $(WORK_DIR) files..." + @rm -f $(LIBOFDT_OBJS) $(LIBOFDT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/libofdt_src/README new/librtas-1.3.4/libofdt_src/README --- old/librtas-1.3.3/libofdt_src/README 1970-01-01 01:00:00.000000000 +0100 +++ new/librtas-1.3.4/libofdt_src/README 2009-05-19 00:42:31.000000000 +0200 @@ -0,0 +1,57 @@ + +In most linux systems, most of the hardware bindings and values are exported +through /proc/devic-tree. This needs to be accessed frequently to query values +to enable or disable many functions on the system. Here, We attempt to provide +an API to read values and parse data that maybe required for many utilities +to do commonly required operations. Please note that this API only reads +and parses values. It does not modify anything. + +The API is as follows: + +1: +void ofdt_get(const char *path) +This function accepts a relative path to the deivce-tree. It can also be +NULL. If the value is null, the base path to the device-tree +/proc/device-tree is assumed. If the value is non null, a relative path +is assumed and /proc/device-tree is added to the path to fully qualify it. + +This function builds a complete tree from the given path. It processes +sub-directories and will also parse ibm,indexes file and find appropriate +values for "ibm,drc-name", "ibm,drc-type" & "ibm,drc-powerdomain" for the +approprate "ibm,my-drc-index" files. It fills these out and sends back +a pointer to the the head of the tree. + +It is always nice to call ofdt_put after this function has been called +with the right head pointer. + + +2: +void ofdt_put(struct node *delete) + +This function takes a node pointer type, normally this is the head of +a tree structure that needs to be freed. It is normally a good idea +to free the stuff allocated. But just incase you forget, there is a +fini_routine that takes care of it. + +3: +struct property *ofdt_get_property(struct node *prop_node, + const char * name); + +This function takes a path to the property and a node pointer. The node +pointer is normally the head of a fully populated tree structure formed +by ofdt_get() with appropriate values. The function returns the requested +property from the given tree. + +4: +struct property * ofdt_get_property_by_name(const char * path); + +This function returns a structure of type property. It builds and +returns the property from the given path. It does not build a tree. +It will also not return any property that does not exist like +for eg: when a ibm,my-drc-index exists and other properties do not, it +will return a NULL pointer. + +5: +void ofdt_property_put(struct property * to_delete); + +This function frees all properties that are passed in to this function. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/librtasevent.h new/librtas-1.3.4/librtasevent_src/librtasevent.h --- old/librtas-1.3.3/librtasevent_src/librtasevent.h 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/librtasevent.h 2009-05-19 00:42:31.000000000 +0200 @@ -380,6 +380,7 @@ #define RTAS_IO_SUBTYPE_REBALANCE 0x01 #define RTAS_IO_SUBTYPE_NODE_ONLINE 0x02 #define RTAS_IO_SUBTYPE_NODE_OFFLINE 0x04 +#define RTAS_IO_SUBTYPE_PLAT_DUMP_SZ 0x05 uint32_t drc_index:32; /**< DRC index */ char rpc_data[216]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/librtasevent_v4.h new/librtas-1.3.4/librtasevent_src/librtasevent_v4.h --- old/librtas-1.3.3/librtasevent_src/librtasevent_v4.h 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/librtasevent_v4.h 2009-05-19 00:42:31.000000000 +0200 @@ -11,6 +11,7 @@ #ifndef _H_RTAS_EVENT_HDRS #define _H_RTAS_EVENT_HDRS +#include <librtasevent.h> #include <inttypes.h> #define RE_V4_SCN_SZ 28 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/librtasevent_v6.h new/librtas-1.3.4/librtasevent_src/librtasevent_v6.h --- old/librtas-1.3.3/librtasevent_src/librtasevent_v6.h 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/librtasevent_v6.h 2009-05-19 00:42:31.000000000 +0200 @@ -11,6 +11,7 @@ #ifndef _H_RE_V6_RTAS_EVENT #define _H_RE_V6_RTAS_EVENT +#include <librtasevent.h> #include <inttypes.h> /** @@ -137,6 +138,8 @@ #define RTAS_DUMP_SUBTYPE_SMA 0x03 #define RTAS_DUMP_SUBTYPE_POWER 0x04 #define RTAS_DUMP_SUBTYPE_LOG 0x05 +#define RTAS_DUMP_SUBTYPE_PARTDUMP 0x06 +#define RTAS_DUMP_SUBTYPE_PLATDUMP 0x07 uint32_t id:32; /**< dump id */ uint32_t location:1; /**< 0 => dump sent to HMC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/Makefile new/librtas-1.3.4/librtasevent_src/Makefile --- old/librtas-1.3.3/librtasevent_src/Makefile 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/Makefile 2009-05-19 00:42:31.000000000 +0200 @@ -17,7 +17,7 @@ LIBRE_HDRS = librtasevent.h librtasevent_v4.h librtasevent_v6.h HEADERS = $(LIBRE_HDRS) rtas_event.h -CFLAGS += -fPIC -DPIC +CFLAGS += -fPIC -DPIC -I. LDFLAGS += -shared -Wl,-soname -Wl,$(LIBRE_SONAME).$(MAJOR_NO) all: $(LIBRE_OBJS) $(HEADERS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/rtas_io.c new/librtas-1.3.4/librtasevent_src/rtas_io.c --- old/librtas-1.3.3/librtasevent_src/rtas_io.c 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/rtas_io.c 2009-05-19 00:42:31.000000000 +0200 @@ -231,6 +231,10 @@ case 0x04: len += rtas_print(" - Node off-line.\n"); break; + + case 0x05: + len += rtas_print(" - Platform Dump maximum size change.\n"); + break; default: len += rtas_print(" - Unknown subtype.\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtasevent_src/rtas_post.c new/librtas-1.3.4/librtasevent_src/rtas_post.c --- old/librtas-1.3.3/librtasevent_src/rtas_post.c 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtasevent_src/rtas_post.c 2009-05-19 00:42:31.000000000 +0200 @@ -48,7 +48,7 @@ /* and lastly, the location code */ rtas_copy(post->loc_code, re, 8); - post->firmware_rev[8] = '\0'; + post->loc_code[8] = '\0'; add_re_scn(re, post, RTAS_CPU_SCN); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtas-ppc64.spec new/librtas-1.3.4/librtas-ppc64.spec --- old/librtas-1.3.3/librtas-ppc64.spec 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtas-ppc64.spec 2009-05-19 00:42:31.000000000 +0200 @@ -1,5 +1,5 @@ %define name librtas -%define version 1.3.3 +%define version 1.3.4 %define release 0 Summary: Libraries to provide access to RTAS calls and RTAS events. Name: %{name} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtas_src/common.c new/librtas-1.3.4/librtas_src/common.c --- old/librtas-1.3.3/librtas_src/common.c 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtas_src/common.c 2009-05-19 00:42:31.000000000 +0200 @@ -7,6 +7,8 @@ * @author John Rose <johnrose@us.ibm.com> */ +#include <sys/types.h> +#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "librtas.h" @@ -65,7 +67,7 @@ npaths = sizeof(proc_rtas_paths) / sizeof(char *); for (i = 0; i < npaths; i++) { sprintf(full_name, "%s/%s", proc_rtas_paths[i], name); - fd = open(full_name, mode); + fd = open(full_name, mode, S_IRUSR | S_IWUSR); if (fd >= 0) break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtas_src/librtas.h new/librtas-1.3.4/librtas_src/librtas.h --- old/librtas-1.3.3/librtas_src/librtas.h 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtas_src/librtas.h 2009-05-19 00:42:31.000000000 +0200 @@ -10,6 +10,7 @@ #ifndef _LIBRTAS_H_ #define _LIBRTAS_H_ +#include <sys/types.h> #include <stdint.h> #define RTAS_KERNEL_INT -1001 /* No Kernel Interface to Firmware */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtas_src/ofdt.c new/librtas-1.3.4/librtas_src/ofdt.c --- old/librtas-1.3.3/librtas_src/ofdt.c 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtas_src/ofdt.c 2009-05-19 00:42:31.000000000 +0200 @@ -31,14 +31,15 @@ char *path; int len; - len = strlen(prop_path) + strlen(prop_name) + 1; + /* allocate enough for two string, a slash and trailing NULL */ + len = strlen(prop_path) + strlen(prop_name) + 1 + 1; path = malloc(len); if (path == NULL) { errno = ENOMEM; return -1; } - sprintf(path, "%s/%s", prop_path, prop_name); + snprintf(path, len, "%s/%s", prop_path, prop_name); *fd = open(path, O_RDONLY); free(path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/librtas_src/syscall_rmo.c new/librtas-1.3.4/librtas_src/syscall_rmo.c --- old/librtas-1.3.3/librtas_src/syscall_rmo.c 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/librtas_src/syscall_rmo.c 2009-05-19 00:42:31.000000000 +0200 @@ -7,6 +7,8 @@ * @author John Rose <johnrose@us.ibm.com> */ +#include <sys/types.h> +#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> @@ -117,7 +119,8 @@ /* Lazily open lock file */ if (wa_config.lockfile_fd < 0) { - wa_config.lockfile_fd = open(lockfile_path, O_CREAT | O_RDWR); + wa_config.lockfile_fd = open(lockfile_path, O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR); if (wa_config.lockfile_fd < 0) { dbg1("could not open lockfile %s\n", lockfile_path); return RTAS_IO_ASSERT; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/Makefile new/librtas-1.3.4/Makefile --- old/librtas-1.3.3/Makefile 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/Makefile 2009-05-19 00:42:31.000000000 +0200 @@ -7,7 +7,7 @@ .SILENT: FILES = README COPYRIGHT -SUBDIRS = librtas_src librtasevent_src +SUBDIRS = librtas_src librtasevent_src libofdt_src TARBALL_FILES += $(FILES) doxygen.rtas doxygen.rtasevent Changelog @@ -27,6 +27,7 @@ @export DESTDIR=$(SHIPDIR); $(MAKE) install @rm $(SHIPDIR)/usr/lib/librtas.so @rm $(SHIPDIR)/usr/lib/librtasevent.so + @rm $(SHIPDIR)/usr/lib/libofdt.so @$(RPM) -bb $(SPECFILE) @rm -rf $(SHIPDIR) @@ -34,8 +35,10 @@ @echo "Creating doxygen documents..." @mkdir -p doc/librtasevent @mkdir -p doc/librtas + @mkdir -p doc/libofdt @$(DOXYGEN) doxygen.rtas @$(DOXYGEN) doxygen.rtasevent + @$(DOXYGEN) doxygen.ofdt tarball: clean @echo "Creating release tarball..." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.3/rules.mk new/librtas-1.3.4/rules.mk --- old/librtas-1.3.3/rules.mk 2007-12-12 23:31:25.000000000 +0100 +++ new/librtas-1.3.4/rules.mk 2009-05-19 00:42:31.000000000 +0200 @@ -135,7 +135,7 @@ endef define install_lib - $(call install_files,$1,755,$2/$(LIB_DIR)) + $(call install_files,$1,755,$2/$(LIB_DIR)$(findstring 64,$(shell file $(firstword $1)))) endef define install_inc ++++++ librtas-failedmagic.patch ++++++ --- rules.mk +++ rules.mk @@ -135,7 +135,7 @@ endef define install_lib - $(call install_files,$1,755,$2/$(LIB_DIR)$(findstring 64,$(shell file $(firstword $1)))) + $(call install_files,$1,755,$2/$(LIB_DIR)) endef define install_inc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org